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-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, November 13, 2014 3:37 PM
Points: 104, Visits: 326
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
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: 2 days ago @ 12:57 PM
Points: 546, Visits: 1,062
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: 2 days ago @ 6:02 AM
Points: 7,135, Visits: 12,744
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
Post #1434626
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse