How to get list of databases from SQL Server



List of databases

SELECT name FROM master.sys.databases

Count database

SELECT count(name) as total FROM master.sys.databases