I want to covert varchar (50) column to date format. I used following code:
Update [dbo].[KYCStatus062013]
Set [REGISTRATION_DATE_]= convert(datetime,[REGISTRATION_DATE_] ,103)
But there is an error that says:
Msg 241, Level 16, State 1, Line 1 Conversion failed when converting date and/or time from character string.
I want this format: dd-mmm-yyyy. I do not have any option to create another table / column so "update" is the only way I can use. Any help will be highly appreciated.
Edit: my source data looks like this:
21-MAR-13 07.58.42.870146 PM
01-APR-13 01.46.47.305114 PM
04-MAR-13 11.44.20.421441 AM
24-FEB-13 10.28.59.493652 AM
Edit 2: some of my source data also contains erroneous data containing only time. Example:
12:02:24
12:54:14
12:45:31
12:47:22