GeekInterview.com
Series: Subject: Topic:
Question: 58 of 216

How to change the column name by using ALTER?

I Tried by giving.........................

ALTER table table name rename column to

column name was changed but it's not giving entire table with altered column name.

It's giving only the altered column.
Asked by: ushalakshmi | Member Since Apr-2008 | Asked on: Apr 16th, 2008

View all questions by ushalakshmi   View all answers by ushalakshmi

Showing Answers 1 - 5 of 5 Answers
prakashb83

Answered On : Apr 17th, 2008

View all answers by prakashb83

sp_rename 'oldtablename.cname', 'change columnname'

  
Login to rate this answer.

Please try Alter table change <Old column name > <new column name> varchar(10)

  
Login to rate this answer.
sweetytrivedi

Answered On : Jun 17th, 2008

View all answers by sweetytrivedi

To change the column name can use the Rename command.alter table rename column to ;

Yes  1 User has rated as useful.
  
Login to rate this answer.

sp_rename 'TableName.OldColumnName','NewColumnName' is correct

  
Login to rate this answer.
malapati

Answered On : Oct 8th, 2008

View all answers by malapati

To change name of one column   alter  table  rename column to ;if we want to change more than one column  alter  table   rename (old colname1,old colname2,-------) to (new colname1,new colname2,------);

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.