从 SQL Server 到 postgresql 的 DBLink:获取序列 nextval
我有一个 SQL Server 2008,需要连接到 POSTGRESQL 9.0 服务器。
我需要的任务之一是通过 POSTGRESQL
示例 1:
execute ('select nextval( ''cadastro.pessoa_seq'' )' ) at POSTGRESQL ;
错误获取序列的下一个值:
消息 7215,级别 17,状态 1,第 1 行无法执行语句 远程服务器“POSTGRESQL”。*
示例 2:
select * from openquery( POSTGRESQL ,'select nextval( ''cadastro.pessoa_seq'' )')
错误:
消息 7399,级别 16,状态 1,第 1 行 OLE DB 提供程序“MSDASQL” 链接服务器“POSTGRESQL”报告错误。该提供商报告了 意外的灾难性失败。消息 7350,16 级,状态 2,第 1 行 无法从 OLE DB 提供程序“MSDASQL”获取列信息 链接服务器“POSTGRESQL”。*
这些选项都不起作用!
有什么好的替代方案吗?
先感谢您
I've got a SQL Server 2008 that needs to connect to a POSTGRESQL 9.0 server.
One of the tasks that i need is to get the next value of a sequence over the POSTGRESQL
Example 1 :
execute ('select nextval( ''cadastro.pessoa_seq'' )' ) at POSTGRESQL ;
error:
Msg 7215, Level 17, State 1, Line 1 Could not execute statement on
remote server 'POSTGRESQL'.*
Example 2 :
select * from openquery( POSTGRESQL ,'select nextval( ''cadastro.pessoa_seq'' )')
error:
Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "MSDASQL" for
linked server "POSTGRESQL" reported an error. The provider reported an
unexpected catastrophic failure. Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "MSDASQL" for
linked server "POSTGRESQL".*
None of these options works!
Is there any good alternative ?
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
处理 ODBC 源和 postgres 我必须这样做:
dealing with ODBC sources and postgres I have to do this:
也许您的 Postgresql 连接是只读的,您是否尝试执行更新/插入请求?
nextval 更新序列,尝试:
Perhaps your Postgresql connection is readonly , have you tried to execute an update/insert request ?
nextval update the sequence , try: