November 8, 2016 at 7:29 am
Hi,
I ran below tsql to find the database owner but for some of the databases the owner returned NULL. Manually from properties tab in SSMS, I can able to see the some other person name but why it is displaying null from query
select name, suser_sname(owner_sid) from sys.databases;
November 8, 2016 at 7:46 am
Perhaps the owner no longer exists on the server. Try joining sys.databases to sys.server_principals on owner_id = sid.
John
November 8, 2016 at 6:26 pm
Thank you.
Instead of
select name, suser_sname(owner_sid) from sys.databases
I enter
select name, suser_name(owner_sid) from sys.databases;
It is working fine
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy