SQL server 存储过程实现统计赋值

 @EmptyCount int output

参数

declare  @strCount nvarchar(max);

声明变量

取值语句:

set  @strCount='select @Count=count(1)
     from   testtable AS  B  
     WHERE    B.Status=0 
      ';

执行命令语句

    EXECUTE SP_EXECUTESQL @strSQL ; 
    EXECUTE SP_EXECUTESQL @strCount,N'@Count int output',@EmptyCount output  ; 

 

posted @ 2017-10-25 16:02  蜜雪粮液  阅读(1023)  评论(0)    收藏  举报