To list all databases in MSSQL you can use the following snippet.

Sample 1 MSSQL

SELECT name FROM master..sysdatabases

Sample 2 MSSQL

EXEC sp_databases

One thought on “How to list all databases in MSSQL”

Leave a Reply