ssms - Strange behaviour when renaming a column in SQL Server 2008 -
I need to write some code to change the column name in SQL Server 2008. A duplicate renaming:
NAME1 ==> TEMPNAME ==> NAME2
Apply a BEGIN transfer sp_rename N'dbo.Table_1.columFirstName ', N'Tmp_columSecondName_2', 'Columns' GO Exclute sp_rename N'dbo.Table_1.Tmp_columSecondName_2 ', N'columSecondName', 'COLUMN' Go Object Table dbo.Table_1 SET (LOCK_ESCALATION = TABLE) Go COMMIT
But When I walk once, it just works fine.
Why is the name of the column first given a temporary name?
Thanks
You can swap column names between two columns. Management studios re-name all the columns with the names of temporary names, and then change them to the names of the last names.
BloggerBird: Right-click menu in the design window, generates a script option
Comments
Post a Comment