Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3 tables, 2 instances, 1 query ....and a partridge in a pear tree!!!

Status
Not open for further replies.

NevG

Programmer
Joined
Oct 10, 2000
Messages
162
Location
GB
hi gang

I have 3 tables spread over 2 sql instances and I need to query both of them...

I know I can do this by fully qualifying the server name etc. in the query syntax... HOWEVER - I do not know what the name of the server is going to be.

I also know that I can check the sysservers table to find out the name HOWEVER - I dont know how many instances are going to be on the machine and which one I need. I DO know the name of the table (obvioulsy) so ... HOW CAN I:

a) Get the correct name of the correct instance I need by checking to see whether that instance contains the table I need?
b) Include this name in a SQL Query - Im assuming Im going to have to use a sp_execsql kinda path as am going to have to compile this string as Im going...

Any help much appreciated.

Cheers

NG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top