Stored Procedure - SP_RENAME

This stored procedure is used for changing the name of the table and for changing the name of the column.

Syntax to change the name of the table:

SP_RENAME 'OLD TABLENAME','NEW TABLENAME'

Example:

SP_RENAME 'EMP','EMPLOY'

The above stored procudure changes the name of EMP table to EMPLOY

Syntax to change the name of the column

SP_RENAME 'TABLEOLDCOLUMNNAME','NEW COLUMNNAME'

Example:

SP_RENAME 'STUDENT.ADR', ADDRESS

The above stored procudure changes the name of ADR column to ADDRESS in STUDENT table.
Share/Bookmark

No comments: