6:45 AM EST.The ultimate source for Indian Resources in USA, Canada and UK.Sign In!

How Rename a Column or Table in SQL SERVER

Category: SQL Server
view more software blogs >>
Updated: 7/14/2010 1:06:57 PM
Author: Shiju Kadamala

A table name can be changed by using sp_RENAME function

Transact-SQL Syntax :

Where 'object_type' is the type of object being renamed. object_type is varchar(13), with a default of NULL, and can be one of these values. The Values for 'object_type' are

Value Description
COLUMN A column to be renamed.
INDEX A user-defined index.
OBJECT An item of a type tracked in sys.objects. For example, OBJECT could be used to rename objects including constraints (CHECK, FOREIGN KEY, PRIMARY/UNIQUE KEY), user tables, and rules.
USERDATATYPE An alias data type or CLR User-defined Types added by executing CREATE TYPE or sp_addtype.

The script for renaming any object (database, table, sp etc) :

The script for renaming any column

User Comments/reviews

Add a New Comment/Review
Display Name
Email Address:
Comment/ Review/Posting
( 1012 Charectors maximum)
Rating:     ( 1- Not Recommended  5- Highly Recommended)

Related Blogs