I tried creating a table as follows:
create table table1(date1 datetime,date2 datetime);
I tried inserting values as below:
insert into table1 values('21-02-2012 6:10:00 PM','01-01-2001 12:00:00 AM');
I encountered this error:
Cannot convert varchar to datetime.
I tried this as a solution :
insert into table1 values(convert(datetime,'21-02-2012 6:10:00 PM',5)
,convert(datetime,'01-01-2001 12:00:00 AM',5));
But still getting the error saying:
Conversion failed when converting date and/or time from character string
Can someone help me with this?