Hi,
I'm working with a table with more than 2 million rows. The problem is that the table has a field called "ShipDate" of type nvarchar. When I try to change the data type to DateTime sql server throws a data conversion error.
I noticed that the date format is as follow: 2006-10-23, so, is there a way sql server takes this field and change it using the field values and applying the correct format? meaning: 10/23/2006
thanks a lot
The mentioned value should be easily converted into a datetime column (2006-10-23). You seem to have corrupt data stored in the datecolumn. Try to get rid of it and prior identify it by using the following query:
SELECT Datecolumn
FROM SomeTable
WHERE ISDATE(Datecolumn) = 0
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
No comments:
Post a Comment