sql-serverselectviewlinked-server

Unable to Query a View from a Linked SQL Server


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:


Solution

  • 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.