Skip to content

Instantly share code, notes, and snippets.

@thanglequoc
Created September 14, 2019 04:20
Show Gist options
  • Select an option

  • Save thanglequoc/dd2fe45d411efa6f636a44bce35546c7 to your computer and use it in GitHub Desktop.

Select an option

Save thanglequoc/dd2fe45d411efa6f636a44bce35546c7 to your computer and use it in GitHub Desktop.

Revisions

  1. thanglequoc created this gist Sep 14, 2019.
    10 changes: 10 additions & 0 deletions ListOwner.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    -- list database and owner id
    SELECT SUSER_NAME(owner_sid), * FROM sys.databases;

    -- view login creation date
    SELECT *
    FROM master.sys.sql_logins;

    -- view database
    SELECT *
    FROM master.sys.databases;