Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Renaming a Column name

Author  Topic 

newman
Starting Member

7 Posts

Posted - 2005-08-27 : 09:20:55
hello friends!

1 silly dought again..

I hav a table with 4 columns and it has 5 rows..

Now i want to change the name of 1 of the column

Is there any query to rename an existing column??

THANK YOU!

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-08-27 : 09:33:13
Look in Books Online for "sp_rename", it will do the trick.

Be aware that sp_rename will only rename the column, it will not fix references to that column in your procedure or view definitions. You will need to rewrite those if they are affected by the change.
Go to Top of Page

l-jeff@excite.com
Starting Member

39 Posts

Posted - 2008-06-05 : 14:40:01
Can I rename all my columns? If I use sp_rename it will only allow me 1 change.

Lisa Jefferson
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-06-05 : 15:33:55
Why?
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-06-05 : 23:18:04
Have to do it one by one. Depends on new column names, you maybe able to generate script for that.
Go to Top of Page
   

- Advertisement -