June 3, 2011 at 9:39 am
Hi I need help to convert a field (nvarchar(255), null) for example 30-07-2007 to datetime 2007-07-30.
Thanks for your help.
June 3, 2011 at 10:19 am
Something along the lines of
Select convert(datetime, N'30-07-2007', 105)
June 3, 2011 at 10:35 am
sorry, I am getting in this format, Jan 11 2006 12:00AM which is not right.
any idea?
June 3, 2011 at 11:06 am
the example converts string to datetime...then if you want a specific format, you've got to convert it back again:
--Results
/*
2007-07-30
*/
Select convert(varchar(10),convert(datetime, N'30-07-2007', 105) ,120)
Lowell
June 3, 2011 at 11:12 am
It worked.Thanks a lot!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply