ALTER PROCEDURE [dbo].[P_OA_JudgeFromValueWhere]@FromNo nvarchar(500),@strSql nvarchar(500),@ErrorCount int OUTPUTASBEGIN EXEC ('SELECT '+@ErrorCount+'=COUNT(*) FROM V_OA_FromValueInfo WHERE FromNo='+@FromNo+' and '+@strSql); IF @@ERROR > 0 BEGIN SET @ErrorCount = -1; RETURN END END
那里有问题,编译能过,执行报错 : '=' 附近有语法错误。
6 回答
慕容708150
TA贡献1831条经验 获得超4个赞
你的语法不对,不能这么输出参数。得用这个
sp_executesql [@stmt =] stmt
[
{, [@params =] N'@parameter_name data_type [,...n]' }
{, [@param1 =] 'value1' [,...n] }
]
补充示例:
DECLARE @Count INT
EXECUTE SP_EXECUTESQL N'SELECT @TempCount = COUNT(*) FROM SPT_MONITOR',
N'@TempCount INT OUTPUT',
@TempCount =@Count OUTPUT
PRINT @Count
- 6 回答
- 0 关注
- 578 浏览
添加回答
举报
0/150
提交
取消