Thursday, 26 September 2013

Determine Database Owner


Determining the database owner is important if you want to take advantage of cross-database-ownership-chaining. If databases have different owners, then you have issues with accessing objects between databases.

To find the database owners:

SELECT SUSER_SNAME(owner_sid)
FROM sys.DATABASES

To change the owner of a database:

USE DATABASE
EXEC sp_changedbowner 'sa'

The standard owner for databases is usually sa.


No comments: