Rename SQL Server Schema

前端 未结 7 667
故里飘歌
故里飘歌 2020-12-07 16:42

How can I rename a schema using SQL Server?

7条回答
  •  情书的邮戳
    2020-12-07 17:05

    Easiest solution that worked for me is:
    I have just one schema dbo with two tables PopulationByCountrySTG and CountryRegionSTG

    (1) I created a new schema by executing,

    create schema stg
    

    (2) I executed the following commands,

    ALTER SCHEMA stg TRANSFER dbo.PopulationByCountrySTG;
    ALTER SCHEMA stg TRANSFER dbo.CountryRegionSTG;
    

    All done. Let me know if it works for you.. Thanks Guys.

提交回复
热议问题