在Sybase SQL中,我想执行一个包含SQL语句的字符串。我期望类似这样的内容能够运行。
从exec命令的文档中可以得知以下信息:
declare @exec_str char(100)
select @exec_str = "select 1"
execute @exec_str
go
从exec命令的文档中可以得知以下信息:
execute | exec
is used to execute a stored procedure or an extended stored
procedure (ESP). This keyword is necessary if there are multiple statements in the batch.
execute is also used to execute a string containing Transact-SQL.
但是我上面的例子报错了。我做错了什么吗?