fyi...MS SQL 2005, SSMS
/* 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_table1
(
column1 varchar(50) NULL,
columnX varbinary(50) NULL,
column2 varchar(50) NULL,
column3 varchar(50) NULL,
column4 varchar(50) NULL
) ON [PRIMARY]
GO
IF EXISTS(SELECT * FROM dbo.table1)
EXEC('INSERT INTO dbo.Tmp_table1 (column1, column2, column3, column4)
SELECT column1, column2, column3, column4 FROM dbo.table1 WITH (HOLDLOCK TABLOCKX)')
GO
DROP TABLE dbo.table1
GO
EXECUTE sp_rename N'dbo.Tmp_table1', N'table1', 'OBJECT'
GO
COMMIT
wow!!!
所有跟帖:
• wow!!! fancy to see you again, HappyNow?!! . how r u doing, bud -戲雨飛鷹- ♀ (67 bytes) () 04/27/2009 postreply 11:49:01