Logic flaw

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Logic flaw

Postby tcorrigan5 » Mon Feb 10, 2014 10:50 pm

Seems like there is a logic flaw in your script creation. Script is trying to rebuild the Shipments table with the following code

Code: Select all
PRINT N'Rebuilding [dbo].[Shipments]'
GO
CREATE TABLE [dbo].[tmp_rg_xx_Shipments]
(
[shipmentkey] [int] NOT NULL IDENTITY(1, 1),
[orderkey] [int] NOT NULL CONSTRAINT [DF_Shipments_orderkey] DEFAULT ((0)),
[bolkey] [int] NOT NULL CONSTRAINT [DF_Shipments_bolkey] DEFAULT ((0)),
[shipno] [char] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_Shipments_shipno] DEFAULT (''),
[type] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_Shipments_type] DEFAULT (''),
[quantity] [int] NOT NULL CONSTRAINT [DF_Shipments_quantity] DEFAULT ((0)),
[nopkg] [int] NOT NULL CONSTRAINT [DF_Shipments_nopkg] DEFAULT ((0)),
[noreels] [int] NOT NULL CONSTRAINT [DF_Shipments_noreels0] DEFAULT ((0)),
[skids] [int] NOT NULL CONSTRAINT [DF_Shipments_skids] DEFAULT ((0)),
[freight] [smallmoney] NOT NULL CONSTRAINT [DF_Shipments_freight] DEFAULT ((0)),
[grosswt] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_Shipments_grosswt] DEFAULT ((0)),
[netwt] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_Shipments_netwt] DEFAULT ((0)),
[entered] [smalldatetime] NOT NULL CONSTRAINT [DF_Shipments_entered] DEFAULT (''),
[readied] [smalldatetime] NOT NULL CONSTRAINT [DF_Shipments_readied] DEFAULT (''),
[assigned] [smalldatetime] NOT NULL CONSTRAINT [DF_Shipments_assigned] DEFAULT (''),
[shipped] [smalldatetime] NOT NULL CONSTRAINT [DF_Shipments_shipped] DEFAULT (''),
[readiedby] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_Shipments_readiedby] DEFAULT (''),
[notified] [smalldatetime] NOT NULL CONSTRAINT [DF_Shipments_notifed] DEFAULT ('')
)
GO

Problem is that the Shipments table still exists and hence the constraints on the Shipments still exist but the CREATE TABLE statement is using the same constraint names. SQL Server throws an error about duplicate constraint names.
tcorrigan5
 
Posts: 1
Joined: Sat Feb 08, 2014 2:59 am

Postby Brian Donahue » Thu Feb 13, 2014 1:36 pm

Thanks for contacting us. I believe this is a known issue (SC-6439) and I will reply to you privately with a patch that I think may fix this.

For future reference, this should be fixed in the next release (10.5?) so in the future if you have this problem in v10.5+, please disregard this forum topic.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Compare 10

Who is online

Users browsing this forum: No registered users and 0 guests