between two different SQL Server instances in order to execute direct queries between them. However, the majority of T-SQL auto-complete tools have difficulties to list the objects (i.e. tables) of the linked server's database.
A way to see these objects, is to browse via SSMS's Object Explorer. What about however if you want to have a quick view of all the available tables in the linked server's database while writing your T-SQL script?
USE [ENTER_DATABASE_NAME];
GO
EXEC [dbo].[DBTableInfo] 'LINKED_SERVER_NAME', 'LINKED_SERVER_DB'
GO
The stored procedure displays three columns for each record: (i) Table Schema, (ii) Table Name, (iii) A sample query that can be executed and returns the top 10 rows for the specific table.
Sample output of the stored procedure:
|
Figure 1: Sample Output of the DBTableInfo Stored Procedure. |
You can also download the stored procedure using the following link.