Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Running Query on Multiple Database/Servers Expand / Collapse
Author
Message
Posted Wednesday, March 20, 2013 4:20 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: 2 days ago @ 3:12 PM
Points: 99, Visits: 270
Hi

I have a database table that contains all the server details. I have a query and wanted to run against all servers available in the table.

Sample Query:

SELECT  DISTINCT Col1, Col2 FROM dbo.Test

Requirement

1. Connect to one server
2. Run the Query against all the user DB and save the results into a table.

Please suggest a best way to from SQL server.


Thanks
Shuaib
Post #1433539
Posted Wednesday, March 20, 2013 4:52 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 4:30 PM
Points: 421, Visits: 776
Have a look at this, perhaps it will help.

http://msdn.microsoft.com/en-us/library/ms188427(v=sql.105).aspx
Post #1433543
Posted Saturday, March 23, 2013 2:27 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:14 PM
Points: 6,706, Visits: 11,738
Here is how you would do it using SSIS:

Iterate Over Databases Using SSIS – Part 2


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1434626
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse