aspose file tools*
The moose likes JDBC and the fly likes datepart error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "datepart error" Watch "datepart error" New topic
Author

datepart error

bubu lina
Greenhorn

Joined: Aug 11, 2008
Posts: 28
hello
trying to extract the year from a date database field, i keep on getting sql error:
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 'DATEPART (year, '2007-06-01')' at line 1


this is what i am trying..and not succeeding...:


i am sure this is wrong... but i don't know the correct syntax for this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

"low range", two things:

1) Please check your private messages for an important administrative matter.

2) Please use real words when posting to the forums. Abbreviations such as "err" in place of "error" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2495
    
    8

Is DATEPART supported by mysql?
I did not find it documented in the reference.
They do have a YEAR() function though.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: datepart error