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

query other databases from the information in another database Expand / Collapse
Author
Message
Posted Monday, March 25, 2013 11:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 26, 2013 9:38 AM
Points: 1, Visits: 2
Hi,

I have a database called databaseA with a table called, otherdbs with two columns

server databasename
server1 parts
server2 parts


I would like a query that queries databaseA and table called otherdbs, which then uses the server and databasename to issue another query on each of the databases.

Apologies for the lack of details, is this possible? any hints on where to start would be brilliant.

Post #1435060
Posted Monday, March 25, 2013 11:07 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:50 PM
Points: 23,003, Visits: 31,495
pjuster (3/25/2013)
Hi,

I have a database called databaseA with a table called, otherdbs with two columns

server databasename
server1 parts
server2 parts


I would like a query that queries databaseA and table called otherdbs, which then uses the server and databasename to issue another query on each of the databases.

Apologies for the lack of details, is this possible? any hints on where to start would be brilliant.



Yes, using dynamic sql along with linked servers.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1435061
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse