how to rename the table

Answers were Sorted based on User's Feedback



how to rename the table..

Answer / rajkumar

SP_RENAME 'OLDTABLE NAME', 'NEW TABLE NAME'
eg:
SP_RENAME 'TBL_EMPLOYEE', 'TBL_EMP'

Is This Answer Correct ?    11 Yes 3 No

how to rename the table..

Answer / vishal

Rename a table using sp_rename

sp_rename <Old Table Name>, <New Column Name>


Rename a column using sp_rename
here as third argument we have to provide column. default
third argument for sp_rename is table.


sp_rename <table name>.<old Column Name>, <New Column Name>,
'column'

Is This Answer Correct ?    2 Yes 0 No

how to rename the table..

Answer / mohan

Rename a table
This example renames the customers table to custs.

EXEC sp_rename 'customers', 'custs'

B. Rename a column
This example renames the contact title column in the
customers table to title.

EXEC sp_rename 'customers.contacttitle', 'title', 'COLUMN'

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More SQL Server Interview Questions

Explain primary key, foreign key and unique key?

0 Answers  


What are the different index configurations a table can have?

0 Answers  


How can we write or define DDL statements in Sql server and DML statements?

3 Answers  


Give a example to search fr a string in all stored procedure in sql server.

0 Answers  


What are the types of resultset?

0 Answers  






What is update locks?

0 Answers  


how to get rank of diffrent student in same table based on newly inserted row in sql server2008

4 Answers   ABC,


What is single-user mode and what are the steps you should follow to start sql server in single-user mode?

0 Answers  


What are statistics, under what circumstances they go out of date, how do you update them?

2 Answers   HCL,


Can you create a logon trigger in sql server 2005 express edition?

0 Answers  


How to get the query of a table in sql server?

0 Answers  


What are scalar functions in sql?

0 Answers  


Categories