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

What is the difference between having clause and where clause in sql server?

0 Answers  


How will you fine tune a stored procedure or what are the steps that should be taken to fine tune or optimize a stored procedure?

1 Answers   Logitech, Mphasis,


Describe in brief system database.

0 Answers  


What is dml command?

0 Answers  


Diff. b/w Full Outer Join And Cross Join?

3 Answers  






What happens if the update subquery returns no rows in ms sql server?

0 Answers  


How to change the system date and time from SQL Plus Terminal ?

0 Answers   MCN Solutions,


What is the difference between indexing and hashing?

0 Answers  


what is sql injection in sql server?

2 Answers   TATA,


Write a SQL command to insert and update only a particular field?

0 Answers   ADITI,


how to write the query to select the rows are in the order of either 1,3,5,7... or 2,4,6,8,...

7 Answers   ADP, Satyam, Tech Mahindra,


How to tune a stored procedure?

6 Answers  


Categories