June 24, 2011 at 6:54 am
Hi I gto different servers whose names start with MSX like MSX001, MSX34, MSX674 and so on..
Now i got to get a list of all the databases in that servers so is there any way that i can do it in a single query to get the list of databases in the servers starting with MSX or do i need to query individual server?
Please help me out with this please.
June 24, 2011 at 7:08 am
you'll need to query each server, but the query is the same for each server:
SELECT name FROM master.sys.databases where LEFT(name,3) = 'MSX'
this is where you might want to consider a different tool, like powershell, which can query all the servers easier than doing it in SQL, where you have to get a list of servers, create linked servers for them and then query them.
Lowell
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply