Get the list of db and db owner

  • Hi All,

    Is there any script whereby i can get a list of db and the owner ie who created it? I want the same user when i right click on a db to check the owner.

    I tried the below

    select a.name, a.create_date, b.name from sys.databases a

    inner join syslogins b on a.owner_sid =b.sid

    But it omits some of the db.

    Can someone please help.

    Thanks

    A.

  • Try customizing the results of system stored procedure run against master database

    use master

    sp_helpdb

    -:-)

    Cheer Satish 🙂

  • SELECT

    [name]AS [DBName]

    ,SUSER_SNAME([sid])AS [DBOwner]

    FROM [master].[dbo].[sysdatabases]

    ORDER BY 1

  • sp_helpdb

    [font="Comic Sans MS"]+++BLADE+++[/font]:cool:

  • Adam Bean (4/30/2009)


    SELECT

    [name]AS [DBName]

    ,SUSER_SNAME([sid])AS [DBOwner]

    FROM [master].[dbo].[sysdatabases]

    ORDER BY 1

    this should do it

    select [name] as [DB Name], SUSER_SNAME([owner_sid]) AS [DBOwner] from sys.databases

    order by 1

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 5 posts - 1 through 4 (of 4 total)

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