| 
 | 
 
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 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_userid 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_orderid 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_count 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_fcount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_pcount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_scount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_vcount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_gcount 
GO 
CREATE TABLE dbo.Tmp_dnt_tags 
        ( 
        tagid int NOT NULL IDENTITY (1, 1), 
        tagname nchar(10) NOT NULL, 
        userid int NOT NULL, 
        postdatetime datetime NOT NULL, 
        orderid int NOT NULL, 
        color char(6) NOT NULL, 
        count int NOT NULL, 
        fcount int NOT NULL, 
        pcount int NOT NULL, 
        scount int NOT NULL, 
        vcount int NOT NULL, 
        gcount int NOT NULL 
        )  ON [PRIMARY] 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_userid DEFAULT ((0)) FOR userid 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_orderid DEFAULT ((0)) FOR orderid 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_count DEFAULT ((0)) FOR count 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_fcount DEFAULT ((0)) FOR fcount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_pcount DEFAULT ((0)) FOR pcount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_scount DEFAULT ((0)) FOR scount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_vcount DEFAULT ((0)) FOR vcount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_gcount DEFAULT ((0)) FOR gcount 
GO 
SET IDENTITY_INSERT dbo.Tmp_dnt_tags ON 
GO 
IF EXISTS(SELECT * FROM dbo.dnt_tags) 
       EXEC('INSERT INTO dbo.Tmp_dnt_tags (tagid, tagname, userid,postdatetime, orderid, color, count, fcount, pcount, scount, vcount,gcount) 
                SELECT tagid, tagname, userid, postdatetime,orderid, color, count, fcount, pcount, scount, vcount, gcount FROMdbo.dnt_tags WITH (HOLDLOCK TABLOCKX)') 
GO 
SET IDENTITY_INSERT dbo.Tmp_dnt_tags OFF 
GO 
DROP TABLE dbo.dnt_tags 
GO 
EXECUTE sp_rename N'dbo.Tmp_dnt_tags', N'dnt_tags', 'OBJECT'  
GO 
ALTER TABLE dbo.dnt_tags ADD CONSTRAINT 
        PK_dnt_tags PRIMARY KEY CLUSTERED  
        ( 
        tagid 
        ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
 
GO 
COMMITBEGIN 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 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_userid 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_orderid 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_count 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_fcount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_pcount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_scount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_vcount 
GO 
ALTER TABLE dbo.dnt_tags 
        DROP CONSTRAINT DF_dnt_tags_gcount 
GO 
CREATE TABLE dbo.Tmp_dnt_tags 
        ( 
        tagid int NOT NULL IDENTITY (1, 1), 
        tagname nchar(10) NOT NULL, 
        userid int NOT NULL, 
        postdatetime datetime NOT NULL, 
        orderid int NOT NULL, 
        color char(6) NOT NULL, 
        count int NOT NULL, 
        fcount int NOT NULL, 
        pcount int NOT NULL, 
        scount int NOT NULL, 
        vcount int NOT NULL, 
        gcount int NOT NULL 
        )  ON [PRIMARY] 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_userid DEFAULT ((0)) FOR userid 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_orderid DEFAULT ((0)) FOR orderid 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_count DEFAULT ((0)) FOR count 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_fcount DEFAULT ((0)) FOR fcount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_pcount DEFAULT ((0)) FOR pcount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_scount DEFAULT ((0)) FOR scount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_vcount DEFAULT ((0)) FOR vcount 
GO 
ALTER TABLE dbo.Tmp_dnt_tags ADD CONSTRAINT 
        DF_dnt_tags_gcount DEFAULT ((0)) FOR gcount 
GO 
SET IDENTITY_INSERT dbo.Tmp_dnt_tags ON 
GO 
IF EXISTS(SELECT * FROM dbo.dnt_tags) 
       EXEC('INSERT INTO dbo.Tmp_dnt_tags (tagid, tagname, userid,postdatetime, orderid, color, count, fcount, pcount, scount, vcount,gcount) 
                SELECT tagid, tagname, userid, postdatetime,orderid, color, count, fcount, pcount, scount, vcount, gcount FROMdbo.dnt_tags WITH (HOLDLOCK TABLOCKX)') 
GO 
SET IDENTITY_INSERT dbo.Tmp_dnt_tags OFF 
GO 
DROP TABLE dbo.dnt_tags 
GO 
EXECUTE sp_rename N'dbo.Tmp_dnt_tags', N'dnt_tags', 'OBJECT'  
GO 
ALTER TABLE dbo.dnt_tags ADD CONSTRAINT 
        PK_dnt_tags PRIMARY KEY CLUSTERED  
        ( 
        tagid 
        ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
 
GO 
COMMIT |   
 
 
 
 |