Loop through the list of servers and databases and perform the required query using OPENROWSET. Pseudo-code:Declare cur for SELECT server, database FROM table
while ...
SELECT a.*
FROM OPENROWSET('SQLNCLI', 'Server=' + @Servername + ';Trusted_Connection=yes;',
'SELECT Col1
FROM ' + @databasename + '.dbo.sometable') AS a;
- Lumbago
My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com