Monday, March 10, 2008

How To Rename Column In Sql Server

sp_rename [ @objname = ] 'object_name' ,
                   [ @newname = ] 'new_name' ,
                   [ @objtype = ] 'object_type' ]
          Changes the name of a user-created object

          Table ,View,column.

          New name which have to be replaced the old name.

[@objtype =] 'object_type'
         Specifying it's belong to which type like 
Column, Index etc.


use pubs


In this example Discounts is table name, stor_id is old_columnname, storid in new_columnname, column is an object type.

No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.