Convert Date with characters to mm/dd/yyyy

Posted by peter on Stack Overflow See other posts from Stack Overflow or by peter
Published on 2013-10-24T03:37:33Z Indexed on 2013/10/24 3:54 UTC
Read the original article Hit count: 187

Filed under:
|
|
|

I have a columns called Submit_Date in table Tickets and the datatype of it is Varchar(200) and I am trying to convert it to MM/DD/YYYY format and when i do that i get the following error:

Msg 242, Level 16, State 3, Line 1
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

Sample Data of the table is:

Submit_Date
27-09-2013 16:15:00 CST
30-09-2013 16:30:24 CST
27-09-2013 10:03:46 CST
30-09-2013 14:35:55 CST
25-09-2013 16:28:48 CST
24-09-2013 09:29:45 CST

I tried doing the following:

Select Convert(datetime,Submit_date,101) from dbo.Tickets

Let me know where I am doing wrong.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server