等效于Sybase中的sp_executesql

| 相当于sybase中Sql Server的sp_executesql。     
已邀请:
我认为
exec()
是您所要的。请参阅http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.commands/html/commands/commands56.htm。     
@jasir:过程定义限制为255个字符。无法通过定义例如varchar(1024)? ASE Refrence手册15.7(http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36272.1572/html/commands/X30305.htm) 命令执行的状态:   字符串是包含Transact-SQL命令一部分的文字字符串   执行。字符数没有限制   提供文字字符串。 但是,有时在sybase之上的系统(例如,用于金融市场的Kondor +产品使用ASE 15.x作为数据库)可能会设置限制。在此Kondor +中,无法使用
exec( @SQLQuery) 
如果变量@SQLQuery超过256个字符,则在其所谓的OpenReport(存储过程)中使用。     
对于较旧的ASE,您可以使用以下解决方法: 有存储过程sp_remotesql。 您也可以使用它在本地服务器上运行查询,只需要将本地服务器连接到服务器:
sp_addserver local, NULL, <servername>
其中“ 3”是本地服务器的名称(来自sql.ini)。 您可以添加用于运行sql的快捷方式过程:
create procedure sp_exec_dynsql @p_cmd varchar(255)
as
begin
   exec sp_remotesql \"local\", @p_cmd
end
不幸的是,您的sql字符数限制为255个。     

要回复问题请先登录注册