Red Gate forums :: View topic - Datetime2(0) columns get deployed as Datetime2(7)
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Datetime2(0) columns get deployed as Datetime2(7)

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
nharris



Joined: 05 Oct 2011
Posts: 4

PostPosted: Mon Mar 12, 2012 7:08 pm    Post subject: Datetime2(0) columns get deployed as Datetime2(7) Reply with quote

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.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Thu Mar 15, 2012 4:09 pm    Post subject: Reply with quote

This can happen when you are comparing a source control folder to SQL 2008 and the version of the scripts folder is set to SQL 2005. Because SQL2005 did not have any precision or scale for the datetime2 datatype, they are scripted in the way they would be for SQL 2005.

Changing the databaseVersion in the RedGateDatabaseInfo.xml file in the scripts folder to 10 should fix the issue.
Back to top
View user's profile Send private message
nharris



Joined: 05 Oct 2011
Posts: 4

PostPosted: Thu Mar 15, 2012 7:26 pm    Post subject: Reply with quote

OK, guess it was because I was taking a shortcut by deploying from TFS to a new, empty database on the server without it being linked. Presumably it assumes an earlier version of SQL Server than 2008?

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.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Fri Mar 16, 2012 10:16 am    Post subject: Reply with quote

Hi 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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group