Query to Change Column Name in sql server

I have created an Table Test with wrong column name as EepId instead of EmpID, and now i want to change it to EmpID, the following is the query to get

create table Test

(

EepID int

)

 insert into Test values(2)

 Now I want EepID column to Change to EmpID. The following is the solution

 EXEC sp_rename

    @objname = ‘Test.EepID’,

    @newname = ‘EmpID’,

    @objtype = ‘COLUMN’

Published in:  on May 30, 2008 at 6:58 am Comments (6)
Tags: ,