Sunday, July 6, 2008

Object Schema Ownership

Detect which objects are owned by sql logins -
SELECT * FROM database.INFORMATION_SCHEMA.SCHEMATA
WHERE SCHEMA_OWNER IN (SELECT NAME FROM MASTER.DBO.SYSLOGINS)
GO
USE database;
ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo;
GO

No comments: