-5

I want to rename the column from a table. I have tried:

  • EXEC sp_rename
  • alter table
  • alter table change

Also I do not want to add one more column and assign the data of old column to new and drop old column.

How can I do it ?

Pred
  • 8,789
  • 3
  • 26
  • 46
user3817378
  • 119
  • 10

3 Answers3

0

You can use sp_rename as follows :

EXEC sp_RENAME 'table_name.old_name', 'NEWNAME', 'COLUMN'
RayofCommand
  • 4,054
  • 17
  • 56
  • 92
0

Use the Command

EXEC sp_RENAME 'Table_Name.CololdName', 'ColNewName' , 'COLUMN'

it is working perfectly for me

Rajesh
  • 1,600
  • 5
  • 33
  • 59
0

Its a old version of mssql so does not support above solutions but when i tried like this it works

EXEC sys.sp_rename 'fg.TABLE NAME.OLD_COLUMN_NAME','NEW_COLUMN_NAME','COLUMN';

anyway thanks for your efforts

user3817378
  • 119
  • 10