The Conventional method of accessing the data across Linked servers is
Select * from <servername>.<database>.<schema>.<table>
we can find the list of linked servers by
Select name from sys.servers;
OR
executing stored procedure
sp_linkedservers;
It is not possible to access the temporary table (declared globally) in across linked servers:
If we try to access by using the above conventional method we will get the exception stating:
Database name 'tempdb' ignored, referencing object in tempdb.
We can achieve the same by Using OPENQUERY()
SELECT
* FROM OPENQUERY(linkedservername, ' SELECT * FROM ##A ');
No comments:
Post a Comment