If you want to know the list of all databases on sql server, you can use one of the following query or stored procedure.
SELECT * FROM sys.databases
SELECT * FROM sys.sysdatabases
EXEC sp_msForEachDB 'PRINT ''?'''
some of these may not work in certain version, it depend on your database server version. Just use the one which work with your server.
blog comments powered by