How can I in change the table name using a query statement?
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
This question is related to
sql
sql-server
sql-server-2005
RENAME TABLE old_table_name TO new_table_name;
Syntex for latest MySQL versions has been changed.
So try RENAME command without SINGLE QUOTES in table names.
RENAME TABLE old_name_of_table TO new_name_of_table;
In MySQL :
RENAME TABLE template_function
TO business_function
;
In Postgress SQL:
Alter table student rename to student_details;
rename table name :
RENAME TABLE old_tableName TO new_tableName;
for example:
RENAME TABLE company_name TO company_master;
execute this command
sp_rename 'Employee','EData'
In MySQL
:-
RENAME TABLE `Stu Table` TO `Stu Table_10`
Please use this on SQL Server 2005:
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 will be changed.
Source: Stackoverflow.com