I have an existing table with an existing column named sample_time and the datatype is datetime. I need to alter the table and change the datatype from datetime to datetime2. If I right click on the table and choose Alter Table… I get the alter table tool and I change the datatype from datetime to datetime2(7). When i click OK, I get this error.
When I look at the SQL script that is automatically generated I see this.
I can copy the script to the editor and change the 18 to a 7 (as it should be). Then the script will execute and change my datetime to datetime2 without an error. I searched MSDN for the datetime2 datatype and 18 is not a valid fractional precision.