Logic flaw

tcorrigan5tcorrigan5 Posts: 2
edited February 13, 2014 7:36AM in SQL Compare Previous Versions
Seems like there is a logic flaw in your script creation. Script is trying to rebuild the Shipments table with the following code
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.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    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.
Sign In or Register to comment.