1-. you can check this post: https://stackoverflow.com/questions/1509977/convert-varchar-into-datetime-in-sql-server
someone has the same problem and could solved it with this:
DECLARE @Date char(8)
set @Date='12312009'
SELECT CONVERT(datetime,RIGHT(@Date,4)+LEFT(@Date,2)+SUBSTRING(@Date,3,2))
OUTPUT:
-----------------------
2009-12-31 00:00:00.000
(1 row(s) affected)
2-. if you want to add the same value to a new column , first create the column with an
ALTER TABLE MyTable ALTER COLUMN NullCOl DATATYPE NOT NULL;
and after that you can make
UPDATE TABLE MyTable SET NewCol=CONVERT(datetime,RIGHT(@Date,4)+LEFT(@Date,2)+SUBSTRING(@Date,3,2)) //replace the last part for the code that you use to convert from varchar to date.
Regards