ALTER SCHEMA
In Adventure Works Sample database which is in SQL Server 2005 contains tables like
HumanResources.Employee
HumanResouces.Address
Person.Address
If we run the These tables without giving schema name we can not get the result.
For Eg:SELECT * FROM Employee--Here we wont get results because we are not giving schema name here.
If we write query then only we will get the result like
SELECT * FROM HumanResources.Employee--We can get result here.
Now i want to change the schema from HumanResources to dbo so that i can get the result without mentioning the Schema name before the table
ALTER SCHEMA dbo TRANSFER HumanResources.Employee
This statement changes Table from HumanResources.Employee to Employee. And we can get the result.
HumanResources.Employee
HumanResouces.Address
Person.Address
If we run the These tables without giving schema name we can not get the result.
For Eg:SELECT * FROM Employee--Here we wont get results because we are not giving schema name here.
If we write query then only we will get the result like
SELECT * FROM HumanResources.Employee--We can get result here.
Now i want to change the schema from HumanResources to dbo so that i can get the result without mentioning the Schema name before the table
ALTER SCHEMA dbo TRANSFER HumanResources.Employee
This statement changes Table from HumanResources.Employee to Employee. And we can get the result.
Comments