无法从链接的SQL Server查询视图 [英] Unable to Query a View from a Linked SQL Server

查看:137
本文介绍了无法从链接的SQL Server查询视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SQL Server Management Studio中,我已将SQL Server sql02链接到本地​​服务器,如下所示:

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

我收到以下错误消息:

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.

同意SomeView作为表不存在.我在做什么错了?

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

可能相关的事实:

  • SQL Server的本地版本为10.50.1617
  • 链接服务器的版本为8.0.2282
  • 我可以从视图中的所有基础表中进行选择
  • 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

推荐答案

类似权限问题,您是否检查了视图的权限?您的查询没有错.

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.

这篇关于无法从链接的SQL Server查询视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆