Datetime2(0) columns get deployed as Datetime2(7)
nharris
Posts: 6
SQL Compare version 10.0.0.179 - when deploying changes from source control to a database, columns with data type datetime2(0) get created simply as datetime2. This uses the default precision, making the column datetime2(7).
Re-running a compare shows up the discrepancies and deploying again fixes them.
Re-running a compare shows up the discrepancies and deploying again fixes them.
Comments
Changing the databaseVersion in the RedGateDatabaseInfo.xml file in the scripts folder to 10 should fix the issue.
I just tried linking the DB and creating a test table containing a datetime2(0) column and SQL Compare created a deployment script with the correct column data type definition.
Thanks,
Nigel.
It's all about the RedGateDatabaseInfo.xml file - it's created by SQL Compare and SQL Source Control so that the comparison can generate the scripts in a format acceptable to the version of SQL. That would mean the database was originally SQL 2005 when you checked it into source control, or maybe the file didn't exist. I suspect if the file is missing, it may default to DatabaseVersion=9.