日期:2014-05-16 浏览次数:20635 次
/* 为了防止任何可能出现的数据丢失问题,您应该先仔细检查此脚本,然后再在数据库设计器的上下文之外运行此脚本。*/
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_TB
(
ID int NOT NULL IDENTITY (1, 1)
) ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_TB SET (LOCK_ESCALATION = TABLE)
GO
SET IDENTITY_INSERT dbo.Tmp_TB ON
GO
IF EXISTS(SELECT * FROM dbo.TB)
EXEC('INSERT INTO dbo.Tmp_TB (ID)
SELECT ID FROM dbo.TB WITH (HOLDLOCK TABLOCKX)')
GO
SET IDENTITY_INSERT dbo.Tmp_TB OFF
GO
DROP TABLE dbo.TB
GO
EXECUTE sp_rename N'dbo.Tmp_TB', N'TB', 'OBJECT'
GO
COMMIT