I have a table with the MyTable name and its columns name is
1. sr
2. Name
and i want to rename MyTable into empTable and Name column rename into empName.
MyTable structure as below
Create table MyTable
(
sr int PRIMARY KEY IDENTITY,
Name varchar(100)
)
can any one help me?
Thank in advance
Rename table name and column name using sql query
Ask by Anonymous User
Updated 05 Jan 2013
You can use this code
I'm renaming your table and cloumn name with the storeprocedure sp_Rename
sp_Rename 'MyTable', 'empTable'
Now your table name is empTable after renaming your table and now i am going to rename the Name column into empName.
sp_Rename 'empTable.Name', 'empName'
and now you can see your table
Now verify your table
select * from empTable
I hope this resolve your problem