对链接服务器的存储过程调用存在语法错误?

发布于 2024-11-09 12:45:45 字数 956 浏览 0 评论 0原文

我有一台 Informix 机器,已配置为 SQL Server 中的链接服务器。

我可以远程发送查询并接收查询结果,

SELECT * FROM linkedServer.instanceName.database.myTable

但无法运行

linkedServer.instanceName.database.selectAllFromMYTABLE

存储过程。

我返回的错误消息是“[Informix][Informix ODBC Driver][Informix]发生语法错误。”这并没有多大帮助,只是它告诉我我的请求是以某种形式收到的...

有人可以告诉我通过 SQL Server 执行 Informix 存储过程的正确调用语法是什么吗?大概我搞砸了存储过程调用,因为可以验证存储过程在 Informix 服务器上运行良好。

编辑:添加我正在测试的存储过程的全文,以验证我没有在 Informix 中做一些愚蠢的事情,这会导致 SQL Server 执行出现连锁问题:

CREATE FUNCTION sp_testSP()
   RETURNING char(20) as item_no

   DEFINE item_no char(20);

   FOREACH
    SELECT table_name.item_code
     INTO item_no
     FROM table_name
     WHERE table_name.item_code LIKE 'test%'
     RETURN item_no WITH RESUME;
   END FOREACH;
END FUNCTION

正如我所提到的,这似乎是在 RazorSQL 中工作得很好,我已经将其连接到 Informix,但也许看到这会唤起某人的记忆,因为某些原因 SQL Server 无法使用此返回方法...

I've got an Informix machine I've configured as a linked server in SQL Server.

I can remotely send, and receive the results of, a query for, say

SELECT * FROM linkedServer.instanceName.database.myTable

but can't run the

linkedServer.instanceName.database.selectAllFromMYTABLE

stored procedure.

The error message I'm getting returned is "[Informix][Informix ODBC Driver][Informix]A syntax error has occurred." which is not massively helpful, except that it tells me that my request was received in some form...

Could someone tell me what the correct calling syntax would be to execute an Informix stored procedure via SQL Server? Presumably I'm screwing up the stored procedure call, because the stored procedure can be verified to be working fine on the Informix server.

EDIT: Adding the full text of a stored procedure I am testing, in order to verify I'm not doing something stupid in Informix which is causing a knock-on problem with the SQL Server execution:

CREATE FUNCTION sp_testSP()
   RETURNING char(20) as item_no

   DEFINE item_no char(20);

   FOREACH
    SELECT table_name.item_code
     INTO item_no
     FROM table_name
     WHERE table_name.item_code LIKE 'test%'
     RETURN item_no WITH RESUME;
   END FOREACH;
END FUNCTION

As I've mentioned, this appears to work fine in RazorSQL, which I have connected to Informix, but maybe seeing this will jog someone's memory with some reason why SQL Server can't work with this return method...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

£噩梦荏苒 2024-11-16 12:45:45

在本机 Informix 中,您可能会这样写(大约):

EXECUTE PROCEDURE database@linkedServer:selectAllFromMYTABLE();

我不太确定将实例名称放入其中的位置 - “linkedServer”对应于实例名称(按照我的思维方式)。最接近的方法是:

database@linkedServer:instancename.selectAllFromMyTABLE()
instancename@linkedServer:database.selectAllFromMyTABLE()

但是,这是通过本机 Informix 接口。如果您通过 SQL Server,则语法可能需要是调用过程的本机 SQL Server 语法。理论上,我相信,所使用的 API(ODBC 或其他)应该能够转换为本机 Informix 语法。

In native Informix, you would write (approximately):

EXECUTE PROCEDURE database@linkedServer:selectAllFromMYTABLE();

I'm not sure quite where you'd fit an instance name into that - the 'linkedServer' corresponds to an instance name (to my way of thinking). The nearest approaches would be:

database@linkedServer:instancename.selectAllFromMyTABLE()
instancename@linkedServer:database.selectAllFromMyTABLE()

However, that is via the native Informix interfaces. If you go via SQL Server, then the syntax probably needs to be the native SQL Server syntax for invoking a procedure. In theory, I believe, the API used (ODBC or whatever) should be able to translate to the native Informix syntax.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文