Database Migration, Comparision and Synchronization Tools
Got a SQL Server or .NET question? Discuss it in the forums. (SQL Server Forums | Dot NET Forums)
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

Rename a column

rated by 0 users
Answered (Verified) This post has 2 verified answers | 3 Replies | 2 Followers

Top 150 Contributor
8 Posts
Points 155
Saeed posted on 01-28-2010 3:38 PM

can somebody please help me in renaming a column.. i just want a script to rename a column i just wan to rename a column

copy_prev  to copy_current

So can anybody help me in this.

  • | Post Points: 50

Answered (Verified) Verified Answer

Top 500 Contributor
5 Posts
Points 60

use sp_rename system stored proc

 

http://msdn.microsoft.com/en-us/library/ms188351.aspx

  • | Post Points: 25
Top 10 Contributor
Male
116 Posts
Points 1,335
You can use EXEC sp_rename 'copy_prev', 'copy_current', 'COLUMN' and if you want to rename any table just do it like this EXEC sp_rename 'table_old' , 'table_new'
  • | Post Points: 25

All Replies

Top 500 Contributor
5 Posts
Points 60

use sp_rename system stored proc

 

http://msdn.microsoft.com/en-us/library/ms188351.aspx

  • | Post Points: 25
Top 10 Contributor
Male
186 Posts
Points 2,805

Also make sure that you need to change the queries,procedures,etc to reflect this if the column is referred there

  • | Post Points: 5
Top 10 Contributor
Male
116 Posts
Points 1,335
You can use EXEC sp_rename 'copy_prev', 'copy_current', 'COLUMN' and if you want to rename any table just do it like this EXEC sp_rename 'table_old' , 'table_new'
  • | Post Points: 25
Page 1 of 1 (4 items) | RSS

Copyright © Beyondrelational.com