How to Change Schema of an Object in SQL Server Database-SQL Server / T-SQL Tutorial Part 28

preview_player
Показать описание
SQL Server / TSQL Tutorial
How to Change Schema of an Object(Table,View,Stored Procedure) in SQL Server Database

Link for script used in the video

Scenario:
You are working as SQL Server developer in Life Insurance Company. They have Database Name TechBrothersIT and one of the Schema name the objects are using is TB. They have given you assignment to Rename the Schema to LIFE.How would you do that?

Solution:
There is no straight forward way to rename a schema in SQL Server Database. We have to follow below steps to make this change.

Step 1: Create a New Schema

Step 2: Transfer the Objects to New Schema.

Check out our website for Different SQL Server, MSBI tutorials and interview questions
such as SQL Server Reporting Services(SSRS) Tutorial
SQL Server Integration Services(SSIS) Tutorial
SQL Server DBA Tutorial
SQL Server / TSQL Tutorial ( Beginner to Advance)
Рекомендации по теме
Комментарии
Автор

Always enjoy your tutorials. Very precise and clear. Thanks

qvu
Автор

Thanks a lot for this great tutorial and the URL with extended information. So usefull!!

Sylberful
Автор

Great tutorial; really appreciate your work!

davidobrien
Автор

Thank you for this tutorial. I have a question: Now that I have successfully changed the schema to 'TB', I have views that were created from the tables with the old schema 'TT'. How do I point my view to the new schema to ensure that it references the same table but with the new schema? The original table was TT.Table_name, which was used to create a view and I want my view to reference TB.Table_name. Thanks kindly.

samuelihuoma
Автор

Thank you sir it will be helpful for us

MohitYadav-jyde
Автор

I have also altered schema, but after that i am getting object error while selecting any table without schema.tablename

AmitSingh-erlk
Автор

Msg 15151, Level 16, State 1, Line 20
Cannot find the object 'sales', because it does not exist or you do not have permission.
Msg 15151, Level 16, State 1, Line 21
Cannot find the object 'salesinfo', because it does not exist or you do not have permission.


this the problem i had got
can u you tell how to solve it

adikunam