views:

2281

answers:

3

I Used the following syntax but I couldn't find the rename keyword in SQL server 2005.

Alter table Stu_Table rename to Stu_Table_10

Please help me in renaming the table name using a query statement.

+8  A: 

Use sp_rename:

EXEC sp_rename 'Stu_Table', 'Stu_Table_10'

You can find documentation on this procedure on MSDN.

David M
A: 
RENAME TABLE Stu_Table TO Stu_Table_10
djairo
-1 Incorrect syntax near 'rename'.
Andomar
The question is about SQL Server, your answer is for MySQL.
Sam
A: 

hi

Please use this on sql server2005

sp_rename old_table_name , new_table_name

it will give you "Caution: Changing any part of an object name could break scripts and stored procedures." but your table name willbe changed

Ravindra K.