28.3.10

Rename the table in SQL Server

sp_rename is used to rename the objects.

The syntax is,

sp_rename "Old Object Name","New Object Name"

Code Sample:


drop table Venkat_Table
create table Venkat_Table (id int)
-- Rename the existing table.
exec sp_rename 'Venkat_Table','Venkat_Table_New'
-- To check whether the table is available or not.
-- OR to check the properties of the table.
sp_help 'Venkat_Table_New'

Cheers,

Venkatesan Prabu .J

1 comment:

  1. Hi prabhu, i need ur email id. and pls suggest me the book for sql server which contains basic architecture & clear explanation for Pages, extent,GAM,SGAM,IAM,FILE groups,Transaction log very basic

    ReplyDelete