sql query to get list of all database code example Example: get database list in sql server SELECT name FROM master.dbo.sysdatabases