Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Regarding SQL datetime

Hi!

I have connect my Qlikview to a ODBC SQL server.

Example:

SQL SELECT `date_hi`,

FROM aabridge.`Call_hi`

Then i get all the dates. The format of the dates are in "Datetime" so. "YYYY-MM-DD HH-MM-SS".

Now i want to make a select so i get the years and the month, and that should be easy so i try:

SQL SELECT datepart(yyyy, `date_hi`) AS Year,

datepart(mm, `date_hi`) as Month,

FROM aabridge.`Call_hi`

But then i get SQL error when i try to load saying:

SQL##f - SqlState: 37000, ErrorCode: 1064, ErrorMsg: [MySQL][ODBC 5.1 Driver][mysqld-4.1.20]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(yyyy, `date_hi`) AS Year,

datepart(mm, `date_hi`) as Month,

FROM aabridge' at line 1

SQL SELECT datepart(yyyy, `date_hi`) AS Year,

datepart(mm, `date_hi`) as Month,

FROM aabridge.`Call_hi`

Can someone please help me?

Thank you!

10 Replies
Not applicable
Author

I see, that is actually quite beautiful!

Thank you!