August 7, 2009 at 5:27 am
Hopefully a quick one...
Is there a way to run a SELECT query which returns the names of all databases on a server?
Thanks
August 7, 2009 at 6:51 am
Check out the system table sys.databases.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
August 7, 2009 at 7:38 am
Even that won't show all the databases on a server.
You need to run:
SELECT * FROM master.sys.sysdbreg;
from the DAC to see the hidden mssqlsystemresource database. 😉
Paul
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
August 7, 2009 at 7:46 am
OK, how about "all the databases you should be messing around with" can be accessed through sys.databases? :hehe:
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
August 7, 2009 at 8:00 am
Grant Fritchey (8/7/2009)
OK, how about "all the databases you should be messing around with" can be accessed through sys.databases? :hehe:
:laugh: better :laugh:
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
August 7, 2009 at 8:38 am
Thansk guys
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply