Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

how to convert date in varchar format into datetime

$
0
0
Hello Everyone,I have table in which date is in varchar format i.e. '29/09/2013'now I want to insert the records in table1 into table2 where datatype of datecolumn is datetime so I need to convert the date in Datetime format for that I am writing the following query:Select convert(datetime,ltrim(rtrim(replace('28/09/2013','','')))+' 00:00:00.000') from TMP_MAPPINGbut I am getting error massege:Msg 242, Level 16, State 3, Line 3The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.can any on help me how can I import the data into my main table.

Viewing all articles
Browse latest Browse all 3145

Trending Articles