web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Using mthOfYr and year functions in where clause

(0) ShareShare
ReportReport
Posted on by

I try to use mthOfYr and year functions in a where clause as explained below. When I compile the query the following error message is received (Illegal use of WHERE expression). How can I use these functions in a where clause?

 

select sum (Value) from SalaryCalcDetails where mthOfYr(SalaryCalcDetails.CalcDate)==1

                                               && year(SalaryCalcDetails.CalcDate)==2012;

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    240,347 Most Valuable Professional on at

    You can't use X++ functions in SQL queries. Find first and last day of the month and use normal relation operators (>, <, =).

     Or you could create a view with a computed column and there you can use T-SQL functions.

  • maram fraij Profile Picture
    on at

    ok, thank you

  • Martin Dráb Profile Picture
    240,347 Most Valuable Professional on at

    Please verify the answer if you got what you needed.

  • maram fraij Profile Picture
    on at

    Yes I got it. Thank you

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans