instruction: Mapping for database -> site URL.
response: SELECT name, LOWER('https://' + CASE WHEN PATINDEX('%.Mathoverflow%', name) > 0 THEN CASE WHEN PATINDEX('%.Meta', name) > 0 THEN 'meta.mathoverflow.net' ELSE 'mathoverflow.net' END ELSE CASE WHEN PATINDEX('StackExchange.%', name) > 0 THEN SUBSTRING(name, 15, 200) + '.stackexchange.com' ELSE CASE WHEN PATINDEX('StackOverflow.%', name) > 0 THEN SUBSTRING(name, 15, 200) + '.stackoverflow.com' ELSE CASE WHEN PATINDEX('%.Meta', name) > 0 THEN 'meta.' + SUBSTRING(name, 0, PATINDEX('%.Meta', name)) + '.com' ELSE name + '.com' END END END END) FROM sys.databases WHERE database_id > 5