I have a column named Lastmodified, with a data type of Date, but it should have been DateTime.
Is there any way of converting the column?
When I use the ‘Design’ feature of SQL Server Management Studio I get the following error:
Saving changes is not permitted. The changes you have made require the following
table to be dropped and re-created.
Not really interested in dropping the table, I just want to know if it is possible to convert a column from Date to Datetime or do I have to delete the column and create a new one with the correct data type?
It shouldn’t need to drop the table and recreate it, unless that column is taking part in one or more constraints.
You can just do it using SQL:
(I chose
datetime2overdatetime, since the former is recommended for all new development work, and since the column is currentlydate, I know you’re on SQL Server 2008 or later)