to_date in SQL Server 2005

Posted by Chin on Stack Overflow See other posts from Stack Overflow or by Chin
Published on 2010-04-03T02:00:51Z Indexed on 2010/04/03 8:33 UTC
Read the original article Hit count: 305

Filed under:
|
|
|

Does any one know how I would have to change the following to work with ms sql?

WHERE registrationDate between to_date ('2003/01/01', 'yyyy/mm/dd')
AND to_date ('2003/12/31', 'yyyy/mm/dd');

What I have read implies I would have to construct it using DATEPART() which could become very long winded. Especially when the goal would be to compare on dates which I receive in the following format "2003-12-30 10:07:42". It would be nice to pass them off to the database as is.

Any pointers appreciated.

© Stack Overflow or respective owner

Related posts about sql

Related posts about tsql