/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
CREATE TABLE dbo.Tmp_AccWarehouseExpandDelivery
	(
	ID bigint NOT NULL IDENTITY (1, 1),
	ParentID bigint NOT NULL,
	Serial bigint NOT NULL,
	Type int NOT NULL,
	SerialStr char(20) NOT NULL,
	Value int NOT NULL,
	Date datetime NOT NULL
	)  ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_AccWarehouseExpandDelivery ON
GO
IF EXISTS(SELECT * FROM dbo.AccWarehouseExpandDelivery)
	 EXEC('INSERT INTO dbo.Tmp_AccWarehouseExpandDelivery (ID, ParentID, Serial, Type, SerialStr)
		SELECT ID, ParentID, Serial, Type, SerialStr FROM dbo.AccWarehouseExpandDelivery WITH (HOLDLOCK TABLOCKX)')
GO
SET IDENTITY_INSERT dbo.Tmp_AccWarehouseExpandDelivery OFF
GO
DROP TABLE dbo.AccWarehouseExpandDelivery
GO
EXECUTE sp_rename N'dbo.Tmp_AccWarehouseExpandDelivery', N'AccWarehouseExpandDelivery', 'OBJECT' 
GO
ALTER TABLE dbo.AccWarehouseExpandDelivery ADD CONSTRAINT
	PK_AccWarehouseExpandDelivery PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
CREATE NONCLUSTERED INDEX IX_Serial ON dbo.AccWarehouseExpandDelivery
	(
	Serial
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
COMMIT
