【发布时间】:2011-04-15 17:57:00
【问题描述】:
在 Sybase SQL 中,我想执行一个包含 SQL 的字符串。
我希望这样的东西可以工作
declare @exec_str char(100)
select @exec_str = "select 1"
execute @exec_str
go
来自documentation of the exec command
执行 |执行
is used to execute a stored procedure or an extended stored程序 (ESP)。这个关键字是 如果有多个是必要的 批处理中的语句。
execute 也用于执行包含 Transact-SQL 的字符串。
但是我上面的例子给出了一个错误。我做错了吗?
【问题讨论】: