Monday, January 18, 2010

Transfer Tables between Schemas

Sometimes we accidentally create table in our own user schema instead of dbo (or others). The following code translates between different schema.

Suppose there is a table called Employee which has been created in ragarwal schema instead of dbo. The following code will transfer it to dbo from ragarwal schema.

ALTER SCHEMA dbo
TRANSFER ragarwal.Employee


More on Alter Schema at the following MSDN Link.

No comments:

Post a Comment