database owner is null

  • 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;

  • Perhaps the owner no longer exists on the server. Try joining sys.databases to sys.server_principals on owner_id = sid.

    John

  • 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 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply