Tuesday, March 11, 2014

SQL Server: Check the db owner using T-SQL

This query might come in handy sometimes.

To list all database owners:
select suser_sname(owner_sid), name from sys.databases

To list owners for a particular database
select suser_sname(owner_sid) from sys.databases where name='database_name'
Related Posts Plugin for WordPress, Blogger...