带有多个计数语句的存储过程的SSRS

时间:2017-06-05 14:33:57

标签: sql-server stored-procedures reporting-services ssrs-2008

我有几行查询,它有多个count语句。我已经为select count语句创建了存储过程,并且当我在SSMS上运行它时给出结果但是当我在SSRS中使用存储过程时它只给出第一个查询输出。使用ssrs时如何输出其他查询?

评论代码:

select count(*) as Field1
from #TempTable1;

select count(*) as Field2
from #TempTable2;

select count(distinct ANo) as F3
from #TempTable1;

select count(distinct BNo) as F4
from #TempTable2;

select count(*) as F5
from Table1
where InsertDate >= StartDate
      and InsertDate <= EndDate
      and value1 >= 2
      and TestField = 0;

select count(*) as F6
from Table1
where InsertDate >= StartDate
      and InsertDate <= EndDate
      and value1 >= 2
      and TestField = 1;

select count(*) as F7
from Table1
where InsertDate >= StartDate
      and InsertDate <= EndDate
      and value1 >= 2
      and TestField = 0;

1 个答案:

答案 0 :(得分:0)

终于找到了答案

这就是我所做的 声明了局部变量并在查询

中使用它们

从Table1中选择@ A = count() 从表2中选择@ B = count(

选择@A作为Field1,选择@ B作为Field2

这使输出成为单行。