October 1, 2009 at 9:21 pm
I'm managing 100's of servers. I have a generic tsql script that can exec any tsql dynamically/remotely at each server using a linked server. The only problem is that in the SSMS results window, I get a separate result set for each server. I really need just one result set so I can dump it all to a file. Any help?
.
October 2, 2009 at 7:10 am
Modify the script to dump the results of each query to a temp table and then finish with a select from the temp table.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 2, 2009 at 12:07 pm
Thanks for the response Jack!
So create the temp table in the the shell that executes the remote script, or in the remote script that gets executed? I hope that makes sense.
.
October 2, 2009 at 1:15 pm
I'd do it like this:
Create Table #results(...)
Insert into #results
Select ... from local table
Insert into #results
Select ... from linked table
....
Select * from #results
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 2, 2009 at 7:40 pm
Here's some psuedo code of what I'm doing
set @SqlTxt = 'select SomeCol from SomeTable'
select SvrName from syssevers
while SvrName is not null
begin
exec(@SqlTxt) AT [SvrName]
select next SvrName
end
The exec is really executing on a remote server. Where would I create the temp table in this scenario? Inside the exec?
Thanks!
.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply