I have this remote query (select * from dbo.prod_Enertia_emk_monthly_gas_interface
) with the linked server as LIVEDB. How does SQL know to use the bottom selected query to the remote server? I am puzzled as I have never created a remote query before. How does this call work?
Asked
Active
Viewed 65 times
2

jarlh
- 42,561
- 8
- 45
- 63

Brian Tran
- 115
- 10
-
Is dbo.prod_Enertia_emk_monthly_gas_interface actually a view to a linked server? – UnhandledExcepSean Feb 26 '19 at 14:43
-
I looked for object dbo.prod_Enertia_emk_monthly_gas_interface on both local and remote server and cannot find anything. – Brian Tran Feb 26 '19 at 14:44
-
I search both servers and cannot find the view – Brian Tran Feb 26 '19 at 14:44
-
It might be a synonym. https://stackoverflow.com/questions/11628061/creating-a-linked-server-and-database-alias – UnhandledExcepSean Feb 26 '19 at 14:45
-
The call goes to a view named pdRptEMK3MonthlyGasProdcution on LIVEDB – Brian Tran Feb 26 '19 at 14:45
-
SELECT name, base_object_name FROM sys.synonyms – UnhandledExcepSean Feb 26 '19 at 14:49
-
SQL call object dbo.prod_Enertia_emk_monthly_gas_interface but does a remote call to "PRD_enertia"."dbo"."pdRptEMK3MonthlyGasProduction2" which is a view on remote server – Brian Tran Feb 26 '19 at 14:52
-
The engine needs to know how many columns and which types he's gonna get with your *, so it does a few metadata queries before actually sending the command. This is the result of those queries. – EzLo Feb 26 '19 at 14:52
-
So where can I find how object dbo.prod_Enertia_emk_monthly_gas_interface relates to the remote query? – Brian Tran Feb 26 '19 at 14:54
-
Where does SQL store synonym? – Brian Tran Feb 26 '19 at 14:56
-
I see it in SQL Server Management Studio as a folder under each database. Did that query show there were synonyms? – UnhandledExcepSean Feb 26 '19 at 14:59
-
Thanks to all. It is a SQL synonyms. – Brian Tran Feb 26 '19 at 15:00
-
Thanks Sean. Really do appreciate it. – Brian Tran Feb 26 '19 at 15:04
2 Answers
4
This is either a view or a synonym. Both can be found in SQL Server Management Studio under the database in question.

UnhandledExcepSean
- 12,504
- 2
- 35
- 51