Unable to Query a View from a Linked SQL Server

安稳与你 提交于 2019-12-11 05:26:34

问题


In SQL Server Management Studio, I have linked a SQL Server, sql02 to my local server as such:

sp_addlinkedserver 'sql02'
GO

I can query tables from this server:

SELECT * FROM SQL02.SomeDatabase.dbo.SomeTable

However, when I try to query a view, as in

SELECT * FROM SQL02.SomeDatabase.dbo.SomeView

I get the following error message:

Msg 7314, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI10" for linked server "SQL02" does not contain the 
table ""SomeDatabase"."dbo"."SomeView"". The table either does not exist or the
current user does not have permissions on that table.

Agreed that SomeView does not exist as a table. What am I doing wrong?

Potentially relevant facts:

  • Local version of SQL Server is 10.50.1617
  • Version of linked server is 8.0.2282
  • I can SELECT from all the underlying tables in the view

回答1:


Looks like a permission issue, have you checked the permissions on the view? There's nothing wrong with your query.

Also, have you checked what table does that view query on? Check the table permissions as well.

As a tip: Try to run the view on a specific user and if that's successful try to link the server using that specific user.



来源:https://stackoverflow.com/questions/9087843/unable-to-query-a-view-from-a-linked-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!