SQL Server Management Studio 2005
How to change the column datatype from Varchar to Datetime in SQL Server Management Studio 2005
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 20, 2013, 3:01 AM EDT
ALTER TABLE dbo.SampleTable
ALTER COLUMN columnname DATETIME
GO
Parthiban B49 reputationPosted Aug 20, 2013, 3:05 AM EDT
"Conversion failed when converting datetime from character string."
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 20, 2013, 3:07 AM EDT
If you want convert the column where there is data exist, then make sure all the column value is valid datetime, otherwise it will give error while changing the column type.
Regards,
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 20, 2013, 3:08 AM EDT
if it is 1 then it is valid otherwise invalid
Regards,
Iftikar