select @Sum= sum(Totalpay) from bcs_Sale;
if @strWhere <> ''
begin
exec('select @Sum=sum(Totalpay) from bcs_Sale where '+@strWhere);
end
执行后报错:
消息 137,级别 15,状态 1,第 1 行
必须声明变量 '@Sum'。
if @strWhere <> ''
begin
exec('select @Sum=sum(Totalpay) from bcs_Sale where '+@strWhere);
end
执行后报错:
消息 137,级别 15,状态 1,第 1 行
必须声明变量 '@Sum'。
declare @count int
set @NStatement='select @count=count(*) from ix_spc_planogram'
Exec sp_ExecuteSQL @NStatement,
N'@count int output ',
@count outputselect @count