Logic flaw
tcorrigan5
Posts: 2
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 ('') ) GOProblem 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
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.