list of dbs currently in use sql query code example Example: get database list in sql server SELECT name FROM master.dbo.sysdatabases