Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
How To Change the Ownership of a Schema in MS SQL Server?
Submitted by: AdministratorIf 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
<pre>name owner
------------------- --------------------
dbo dbo
ggl ggl_User
guest guest
...</pre>
Submitted by: Administrator
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
<pre>name owner
------------------- --------------------
dbo dbo
ggl ggl_User
guest guest
...</pre>
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.