Return to Snippet

Revision: 25809
at April 10, 2010 08:40 by perbitsch


Initial Code
EXEC sp_rename 'TableName.ColumnName', 'ColumnName_int', 'COLUMN';
GO
ALTER TABLE 'TableName' ADD COLUMN ColumnName VARCHAR(10);
GO
UPDATE TABLE 'TableName' SET ColumnName = CAST(@ColumnName_int as VARCHAR(10));
GO
ALTER TABLE 'TableName' DROP COLUMN ColumnName;
GO

Initial URL

                                

Initial Description

                                

Initial Title
Changing an int column to a varchar column

Initial Tags

                                

Initial Language
SQL