Skip to main content

Command Palette

Search for a command to run...

Find SQL Database Owner with T-SQL

Updated
1 min read
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

1 views

More from this blog

B

Bradley Schacht - Development

172 posts

Bradley Schacht is a Principal Program Manager on the Microsoft Fabric product team based in Saint Augustine, FL.

Find SQL Database Owner with T-SQL