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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Date function like Month,Year in sql query

(0) ShareShare
ReportReport
Posted on by 2,055

Hi All,

I am using AX 2012 CU7. I was trying to find the month, year function in X++ SQL, but no luck. Actually I have to develop a customize, customer monthly sale report. For this report I was finding the month, year function in SQL. Is there any function so I can write a query like we can in the follwoing way SQL.

seelect * from MyTable where month(MyDate)="06"

OR

I need the following Pattern of the report in AX, if any one can help to develop this report.

0250.report.png

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    235,840 Most Valuable Professional on at
    RE: Date function like Month,Year in sql query

    You can't find SQL functions in X++, because these are two different languages. You seems to  be looking for equivalent functions supported in X++ queries, but they don't exist.

    One option is fetching dates from database and convert them to month numbers in X++, as André suggested. Another approach is using SQL (where you obviously can use SQL function) - the best way is utilizing computed columns.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    297,269 Super User 2025 Season 2 on at
    RE: Date function like Month,Year in sql query

    Hi Nadeem,

    This is not supported in this way. All options for x++ select statements are described on the next page: msdn.microsoft.com/.../aa656402.aspx.

    You can create a temporary table having the separate columns. Then fill this temporary table with a data provider class like you want to print it.

    You can loop the original table and then fill the temporary table per record.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
howalker Profile Picture

howalker 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans