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
 Sp_rename or any

Author  Topic 

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-08-10 : 02:43:34
is there any other process to change the name of the column in a existing table for example table name is 'sample' and column name is 'code'
i expected code by using alter or update commands

With Regards
Kashyap M

Sachin.Nand

2937 Posts

Posted - 2010-08-10 : 02:51:12
You can use


sp_rename 'objectname','newname','objecttype'



Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-08-10 : 02:54:01
quote:

sp_rename 'objectname','newname','objecttype'


i had already executed this procedure i want a code using alter or update commands
plz consider

With Regards
Kashyap M
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-08-10 : 03:03:02
SQL Server does not support renaming columns using ALTER statements.

Also why cannot you use sp_rename??


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-08-10 : 03:06:26
there was no problem for using sp_rename just want to know a little bit more on renaming so i asked. Any way thanks so it was clear that we can not change the name of a Column using alter or update right

With Regards
Kashyap M
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-08-10 : 03:13:11
quote:
Originally posted by kashyap_sql

Any way thanks so it was clear that we can not change the name of a Column using alter or update right

With Regards
Kashyap M



Yes SQL Server does not support column renaming using ALTER statements.


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-08-10 : 09:37:42
ok got the point

With Regards
Kashyap M
Go to Top of Page
   

- Advertisement -