I'm looking for an elegant solution for this problem:
I have two servers, Server1 and Server2.
I am attempting to write a stored procedure on Server1. Within this stored procedure, I want to UNION the results of a SELECT statement with a recordset that I can get by running a stored procedure on Server2.
Running the stored procedure on Server2 from Server1 is not a problem - the linked servers are correctly set up. I have no problems with the queries themselves - it's just unioning the results that I have problems with. I am assuming I can't do:
exec Server2.databasename.spName
UNION
SELECT statement...
The recordsets from the two servers meet the requirements for a union: ie. they have the same number of columns, same types, same names etc....
Thanks!
I have two servers, Server1 and Server2.
I am attempting to write a stored procedure on Server1. Within this stored procedure, I want to UNION the results of a SELECT statement with a recordset that I can get by running a stored procedure on Server2.
Running the stored procedure on Server2 from Server1 is not a problem - the linked servers are correctly set up. I have no problems with the queries themselves - it's just unioning the results that I have problems with. I am assuming I can't do:
exec Server2.databasename.spName
UNION
SELECT statement...
The recordsets from the two servers meet the requirements for a union: ie. they have the same number of columns, same types, same names etc....
Thanks!