Skip to content

Instantly share code, notes, and snippets.

@ThangLeQuoc
Created September 14, 2019 04:20
Show Gist options
  • Save ThangLeQuoc/dd2fe45d411efa6f636a44bce35546c7 to your computer and use it in GitHub Desktop.
Save ThangLeQuoc/dd2fe45d411efa6f636a44bce35546c7 to your computer and use it in GitHub Desktop.
SQL Server - List owners of databases
-- 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment