Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 datetime conversion

Author  Topic 

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2008-05-19 : 04:11:27
I have in text field (nvarchar) following date dd-mm-yyyy
and i would like to convert it to smalldatetime field
in format yyyy-mm-dd.

Is there any explicit way to do it?

thank you

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-19 : 04:26:09
Formatting matters when showing datetime data not while inserting it.
Try this:

Set Dateformat DMY

Select Convert(SmallDatetime, DateCol) as DateCol from Table


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -