T-SQL 2000:四部分表名
我通常不使用链接服务器,所以我不确定我在这里做错了什么。
像这样的查询将适用于来自 sql 2000 的链接的 Foxpro 服务器:
EXEC('Select * from openquery(linkedServer, ''select * from linkedTable'')')
但是,从互联网上的研究来看,这样的查询也应该有效:
Select * from linkedserver...linkedtable
但我收到此错误:
Server: Msg 7313, Level 16, State 1, Line 1
Invalid schema or catalog specified for provider 'MSDASQL'.
OLE DB error trace [Non-interface error: Invalid schema or catalog specified for the provider.].
我意识到它应该是 ServerAlias.Category.Schema.TableName,但是如果我在链接服务器上运行 sp_tables_ex,对于所有表的类别,我只获取数据文件所在位置的网络路径,并且架构为空。
该服务器设置不正确吗? 或者我想做的事情是不可能的?
I don't usually work with linked servers, and so I'm not sure what I'm doing wrong here.
A query like this will work to a linked foxpro server from sql 2000:
EXEC('Select * from openquery(linkedServer, ''select * from linkedTable'')')
However, from researching on the internet, something like this should also work:
Select * from linkedserver...linkedtable
but I receive this error:
Server: Msg 7313, Level 16, State 1, Line 1
Invalid schema or catalog specified for provider 'MSDASQL'.
OLE DB error trace [Non-interface error: Invalid schema or catalog specified for the provider.].
I realize it's supposed to be ServerAlias.Category.Schema.TableName, but if I run sp_ tables _ex on the linked server, for the category for all tables I just get the network path to where the data files are, and the schema is null.
Is this server setup incorrectly? Or is what I'm trying to do not possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 MSDN:
您不能依赖链接服务器的“..”符号的隐式架构名称解析。 对于 FoxPro“服务器”,您必须使用数据库和架构,因为它们映射到您使用的驱动程序中的 FoxPro 对应项(我认为它们映射到文件夹和文件名,但我已经有 10 多年没有使用 ISAM 文件驱动程序了)。
From MSDN:
You cannot rely on the implicit schema name resolution of the '..' notation for linked servers. For a FoxPro 'server' you're going to have to use the database and schema as they map to their FoxPro counterparts in the driver you use (I think they map to folder and file name, but I have't use a ISAM file driver in more than 10 years now).
我认为您需要明确查询的链接服务器部分中的资源,例如:
换句话说,在这种情况下仅将它们点出来是行不通的,您必须更加具体。
I think you need to be explicit about resources in the linked server part of the query, for example:
In other words just dotting them out doesn't work in this case, you have to be more specific.
它实际上是:
ServerAlias.Catalog.Schema.LinkedTable
Catalog 是您在链接服务器上查询的数据库,catalog 是远程表的目录。 因此,有效的四部分名称将类似于
ServerAlias.AdventureWorks.HumanResources.Employee
或
ServerAlias.MyDB.dbo.MyTable
It's actually:
ServerAlias.Catalog.Schema.LinkedTable
Catalog is the database that you're querying on the linked server, and catalog is the catalog of the remote table. So a valid four-part name would look lik this
ServerAlias.AdventureWorks.HumanResources.Employee
or
ServerAlias.MyDB.dbo.MyTable