Learning Curve…

Rename a Column Name in Sql Server…

Posted on: April 5, 2012

The script to check if column exists and then renaming the column:-

IF EXISTS (SELECT * FROM sys.columns WHERE Name = N’OldColumnName’ AND Object_ID = Object_ID(N’TableName’))
BEGIN
   EXEC sp_RENAME ‘TableName.OldColumnName’ , ‘NewColumnName’, ‘COLUMN’
END

Advertisements

1 Response to "Rename a Column Name in Sql Server…"

Hi it’s me, I am also visiting this web site on a regular basis, this site is really nice and the viewers are genuinely sharing pleasant thoughts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Author

Learning days (Calendar)

April 2012
M T W T F S S
« Mar   Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 498,419 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: