Global script for databases and owners

  • Hello all,

    I'm looking for a script that will query the system tables and return all of the database names and their respective owners.

    TIA

    DavidB

  • select db.[name] [database], l.[name] [owner]

    from

     master.dbo.sysdatabases db

    join

     master.dbo.syslogins l

    on

     db.sid = l.sid

    Regards,
    gova

  • Thank you. That is exactly what I needed.

  • Hi,

       This is other way of getting all the DataBase Names ,that has permissions for the current User. 

    that has permissions for the current user.

    Select CATALOG_NAME,SCHEMA_OWNER from INFORMATION_SCHEMA.SCHEMATA

     

    Thanks,

    Murthy.

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

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