TSQL methods to display the owner of schema in a database.
You can use 2 methods to get information about owner of a particular schema or set of schema(s) within the database.
Using INFORMATION_SCHEMA views method (which I prefer most of the times):
USE <DBName>
GO
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
Using query against system catalog:
SELECT s.name AS 'Schema Name', db.name AS 'Database User Name' , svr.name AS 'SQL Server Login Name'
FROM sys.schemas s
INNER JOIN sys.database_principals db ON s.principal_id = db.principal_id
INNER JOIN sys.server_principals svr ON db.sid = svr.sid
WHERE s.name = 'SchemaName'
**__________________________________**
SQL Server MVP, Sr. DBA & industry expert.
-
Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.