为什么 OPENQUERY 不接受变量?
我很清楚 MS SQL Server 不允许在 OPENQUERY 语句中使用变量,并且我知道解决方法。
我想知道的是,有谁知道为什么不允许变量或连接字符串?
这导致人们跳过的障碍简直令人震惊,而且它与 EXEC 等其他功能不符。
有人可以对此发表评论吗?我必须在 MS 贿赂谁才能解决问题?
I am well aware that MS SQL Server does not allow variables to be used in the OPENQUERY statement and I'm aware of the workarounds.
What I'd like to know is, does anyone know WHY variables or concatenated strings are not allowed?
The hoops this causes people to jump through is simply astounding and it just isn't in line with other functions such as EXEC.
Can anyone comment on this? Who do I have to bribe at MS to get his sorted out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该限制是由 SQL Server 中链接服务器的实现方式及其依赖库的工作方式造成的。有一个完整的库链用于传递 SQL 命令,它们都有不同的变量大小和缓存大小。 OCBC 驱动程序本身存在一些限制,因此 8k 是 Microsoft 的安全选择。不允许传递变量只是强制执行 8k 限制规则。
The limitation is caused by the way linked servers are implemented in SQL Server, and the way its dependant libraries work. There is a whole chain of libraries used to pass your SQL Command, all of them have different variable sizes and cache sizes. Some of the limitations are in the OCBC drivers themselves, so 8k is a safe bet from Microsoft. Not allowing you to pass variables just enforces the 8k limit rule.