Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Change the Ownership of a Schema in MS SQL Server?

If you want to change the owner of a schema, you can use the "ALTER AUTHORIZATION" statement using the following syntax:

ALTER AUTHORIZATION ON SCHEMA::schema_name TO user_name

The following tutorial example shows you how to change ownership of schema "ggl" to "ggl_user":

-- Login with "sa"

USE GlobalGuideLineDatabase;

GO

ALTER AUTHORIZATION ON SCHEMA::ggl TO ggl_user

GO

SELECT s.name, u.name AS owner

FROM sys.schemas s, sys.database_principals u

WHERE s.principal_id = u.principal_id;

GO

name   owner

------------------- --------------------

dbo dbo

ggl ggl_User

guest guest

...

 140 views

More Questions for you: