Who Is the Owner of a Schema in MS SQL Server?
Submitted by: AdministratorWhen you create a schema in a database, SQL Server will assign a owner (a database user) to this schema. If your login name is mapped to the owner of a schema at the database level, you have the full permission on all objects in this schema.
The following tutorial exercise shows you how to see who is the owner of a schema:
-- Login with "sa"
USE GlobalGuideLineDatabase;
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 dbo
guest guest
...</pre>
The last query shows that schame "ggl" is owned by "dbo".
Submitted by: Administrator
The following tutorial exercise shows you how to see who is the owner of a schema:
-- Login with "sa"
USE GlobalGuideLineDatabase;
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 dbo
guest guest
...</pre>
The last query shows that schame "ggl" is owned by "dbo".
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Create a Testing Table with Test Data in MS SQL Server? |
☺ | How To Get the Definition of a View Out of the SQL Server? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Create a Large Table with Random Data for Index Testing in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |