I need a SQL query to find the names of existing databases.
For people where "sys.databases" does not work, You can use this aswell;
SELECT DISTINCT TABLE_SCHEMA from INFORMATION_SCHEMA.COLUMNS