Extra parentheses around table default values
JasonR
Posts: 8
For reasons that I do not understand, SSC3 will show uncommitted changes for tables that have not been altered. When reviewed, it appears that the source controlled version of each table includes an extra set of parentheses around any value specified as a default value any value used in a constraint for a field. In addition, "WITH NO CHECK" has been added in front of "ADD CONSTRAINT" wherever it appears.
Any ideas on why this is happening?
Examples below:
Database
Latest source control version
Note that we're using the "shared" database development model.
Any ideas on why this is happening?
Examples below:
Database
[CheckedFlag] [bit] NOT NULL CONSTRAINT [DF_tblAnnualPerformanceHistory_CheckedFlag] DEFAULT (0), ... ALTER TABLE [dbo].[tblAnnualPerformanceHistory] WITH NOCHECK ADD CONSTRAINT [CK_tblAnnualPerformanceHistory] CHECK (([PerfYear] >= 1900 and [PerfYear] <= 2200))
Latest source control version
[CheckedFlag] [bit] NOT NULL CONSTRAINT [DF_tblAnnualPerformanceHistory_CheckedFlag] DEFAULT ((0)), ... ALTER TABLE [dbo].[tblAnnualPerformanceHistory] WITH NOCHECK ADD CONSTRAINT [CK_tblAnnualPerformanceHistory] CHECK (([PerfYear]>=(1900) AND [PerfYear]<=(2200)))
Note that we're using the "shared" database development model.
Comments
We think the issue may be that SQL Source Control has not correctly picked-up the compatibility level of your datbase.
Could you please let us know a couple of pieces of information to help us confirm this?
1. What version of SQL Server is the database running on (2005, 2008, 2008 R2)?
2. What is the Combatibility Level for the db you are source controlling? To find out, go to the Database Properties dialog for the db and select the Options section.
3. What is the database version listed in the RedGateDatabaseInfo.xml file stored in your repository? This file is stored in the "Schema" folder SQL Source Control has created in your version control system.
Thanks,
Chris
Redgate Software
1. SQL Server Version: 2008 (v10.0.5500)
2. Compatibility Level: SQL Server 2008 (100)
3. Database version in XML file: 10
Thanks for that. Unfortunately, that does not point to a Compatibility Level problem and we can't recreate your issue yet.
Can you please send us the entire 'database' and 'latest source control' scripts for your example below?
Also, if you have SQL Compare v10, would you be able to do a comparison between your source control repository and your database to see if the parentheses difference shows up there too?
Thanks
Chris
Redgate Software
I ran a comparison using SQL Compare v10 and the differences appear there as well. Full scripts below.
I should also note that I've been using SQL Data Compare v9 to occasionally refresh the data in the development database with production data. Maybe it's doing something to the constraints?
Database
Source Control