How to list all databases in MSSQL

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

Please Share us:
Please rate this snippet

One thought on “How to list all databases in MSSQL

Leave a Reply