laxcoburn
June 2nd, 2005, 08:07 AM
Hi,
I am having problems updating a datetime field from a varchar field. The varchar field is populated from an import of data from an export from a progress database. No matter what I do to format the imported date field (to format it for different date formats mm-dd-yyyy , mm/dd/yy, yyyymmdd) I get an the
"Syntax error converting datetime from character string" error message.
I have even created a seperate varchar field called testdt and inserted the value: 2005-05-05 08:00:00.000 into it. if I use
update exptel set invoicedon = cast(testdt as datetime)
I get the error message.
If I use
update exptel set invoicedon = '2005-05-05 08:00:00.000 ' it works fine.
So it doesnt appear to be the date format but rather the the fact that I am referencing a varchar field. I am familure with the cast and convert functions and use them to convert datetime fields to varchars but cannot get it to work for varchar to datetime.
What do I need to do to get cast or convert a varchar field to a datetime field?
Thanx in advance
I am having problems updating a datetime field from a varchar field. The varchar field is populated from an import of data from an export from a progress database. No matter what I do to format the imported date field (to format it for different date formats mm-dd-yyyy , mm/dd/yy, yyyymmdd) I get an the
"Syntax error converting datetime from character string" error message.
I have even created a seperate varchar field called testdt and inserted the value: 2005-05-05 08:00:00.000 into it. if I use
update exptel set invoicedon = cast(testdt as datetime)
I get the error message.
If I use
update exptel set invoicedon = '2005-05-05 08:00:00.000 ' it works fine.
So it doesnt appear to be the date format but rather the the fact that I am referencing a varchar field. I am familure with the cast and convert functions and use them to convert datetime fields to varchars but cannot get it to work for varchar to datetime.
What do I need to do to get cast or convert a varchar field to a datetime field?
Thanx in advance