Is this a bug? Comparing sequences in mapped schemas.

WernerWerner Posts: 2 New member
edited December 27, 2016 6:17AM in SQL Compare
Hey,
I am comparing two databases and the objects reside in different schemas. The schema mapping feature allows me to circumvent the different schema names and in the script that is to be executed on the target database all references to the source schema name are being replaced with the target schema name. Except for the schema specification of a sequence…
Maybe the combination of sequences, which are not very popular in SQL Server and the schema mapping, results in a less frequent scenario that allowed this bug to remain undiscovered?
I have been using Redgate Schema Compare since December 2007 and this is the first time I discovered a bug 
This is the error message I received:
Dropping index [IX_FactuurLijnen_PERF5] from [TADMIN].[FactuurLijnen]
Dropping index [IX_Geo_Gemeenten_PERF1] from [TADMIN].[Geo_Gemeenten]
Dropping trigger [TADMIN].[incrementExterneIdFactuurLijnen] from [TADMIN].[FactuurLijnen]
Altering [TADMIN].[FactuurLijnen]
Msg 208, Level 16, State 1, Line 591
Invalid object name 'R00215.SQ_Factuurlijnen'.

The database update failed

Obviously TADMIN is the target schema and R00215 is the source schema.
This is de TSQL code that is causing the problem:

IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE name = N'ExterneId' AND object_id = OBJECT_ID(N'[TADMIN].[FactuurLijnen]', 'U') AND default_object_id = OBJECT_ID(N'[TADMIN].[DF_FactuurLijnen_ExterneId]', 'D'))
ALTER TABLE [TADMIN].[FactuurLijnen] ADD CONSTRAINT [DF_FactuurLijnen_ExterneId] DEFAULT (NEXT VALUE FOR [R00215].[SQ_Factuurlijnen]) FOR [ExterneId]

Using SQL Compare Version 12.0.33.3389 Pro

Comments

Sign In or Register to comment.