【问题标题】:Equivalent to sp_executesql in Sybase相当于 Sybase 中的 sp_executesql
【发布时间】:2011-08-06 13:28:24
【问题描述】:

sybase中Sql Server的sp_executesql是什么等价物。

【问题讨论】:

    标签: sybase


    【解决方案1】:
    【解决方案2】:

    对于较旧的 ASE,您可以使用以下解决方法:

    有存储过程sp_remotesql。 你也可以用它在本地服务器上运行查询,你只需要本地服务器到服务器:

    sp_addserver local, NULL, <servername>

    <servername> 是本地服务器的名称(来自 sql.ini)。

    可以添加运行sql的快捷方式:

    create procedure sp_exec_dynsql @p_cmd varchar(255)
    as
    begin
       exec sp_remotesql "local", @p_cmd
    end
    

    很遗憾,您的 sql 中的字符数限制为 255 个。

    【讨论】:

      【解决方案3】:

      @jasir:255 个字符的限制源于您的过程定义。不可能通过定义来扩展这个限制,例如varchar(1024)?

      ASE 参考手册 15.7 (http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36272.1572/html/commands/X30305.htm) 命令执行的状态:

      string 是包含 Transact-SQL 命令的一部分的文字字符串 执行。字符数没有限制 与文字字符串一起提供。

      但是,有时基于 sybase 的系统(例如 Kondor+,一种使用 ASE 15.x 作为 DB 的金融市场产品)可能会设置限制。在此 Kondor+ 中无法使用

      exec( @SQLQuery) 
      

      在其所谓的 OpenReport(一个存储过程)中,如果变量 @SQLQuery 超过 256 个字符。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-05-11
        • 2023-03-10
        • 2020-10-11
        • 2013-06-11
        • 2013-07-18
        • 2011-11-08
        • 2021-09-14
        相关资源
        最近更新 更多