To list all databases in a SQL Server instance, run the following:
SELECT * FROM sys.sysdatabases
This also outputs metadata about each database including createdate, compatibility level, and the MDF filename.
Popular search terms:
To list all databases in a SQL Server instance, run the following:
SELECT * FROM sys.sysdatabases
This also outputs metadata about each database including createdate, compatibility level, and the MDF filename.