Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Bradley Schacht

Bradley Schacht is a Data Platform Solution Architect on the state and local government team with Microsoft based in Jacksonville, FL. He has co-authored 3 SQL Server books including "SQL Server 2014 Professional Admin". As a former consultant and trainer, he uses his experience on many parts of the Microsoft BI and data platform to help customers deliver the best possible solutions. Bradley frequently presents at community events around the country. He is a contributor to sites such as and an active member of the Jacksonville SQL Server User Group (JSSUG).

Find SQL Database Owner with T-SQL

One thing that on occasion bugs me about PDW or APS or whatever it happens to be called this week is the lack of a UI to do things. I’m not one of those people who has to have a UI to perform operations. I have no problem creating databases, doing backups or creating tables through code. That being said there are times when a UI is helpful to just look up information.

Just today I needed to find out who the database owner was and had to do so through T-SQL. If you look at the sys.databases table you will notice there is an owner_sid column but to the naked eye it is pretty useless. So here is what you need, wrap ownser_sid in syser_sname and you are good to go. Find the code below. Enjoy!

SELECT suser_sname(owner_sid), * FROM sys.databases


Leave a comment on the original post [, opens in a new window]

Loading comments...