This piece of code will get you a list of all databases in current server instance.IF CONVERT(VARCHAR(3), SERVERPROPERTY('ProductVersion')) = '10.' SELECT Name AS CATALOG_NAME FROM sys.databases WHERE Name NOT IN ('master', 'tempdb', 'model', 'msdb', 'Resource')ELSE IF CONVERT(VARCHAR(2), SERVERPROPERTY('ProductVersion')) = '9.' SELECT Name AS CATALOG_NAME FROM sys.databases WHERE Name NOT IN ('master', 'tempdb', 'model', 'msdb', 'Resource')ELSE IF CONVERT(VARCHAR(2), SERVERPROPERTY('ProductVersion')) IN ('8.', '7.') SELECT DISTINCT CATALOG_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME NOT IN ('master', 'tempdb', 'model', 'msdb')ELSE SELECT NULL AS CATALOG_NAME WHERE 1 = 0
E 12°55'05.25"N 56°04'39.16"