I have a string of a date in my sql server database:
'wed feb 16 2005'
How (in sql) do i turn it into a date formatted like this:
2005-02-16 00:00:00.000
Printable View
I have a string of a date in my sql server database:
'wed feb 16 2005'
How (in sql) do i turn it into a date formatted like this:
2005-02-16 00:00:00.000
Assuming your string is always in the same format, you could try out something like this:
Code:Select Convert(smalldatetime, SubString(field, Charindex(' ', field, 0) + 1, Len(field)), 101)
ended up using something similar
Code:convert(smalldatetime, substring(@datestring,4,len(@datestring) -3))