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