SSRS 2008查询在SSRS中返回的结果与直接在Management Studio中不同

时间:2013-12-06 19:12:49

标签: sql reporting-services

希望有人可以在这里提供帮助。我在SSRS 2008中有一个订单打印报告,当我直接在Mgmt Studio的查询中运行它时返回正确的结果,但SSRS中的相同查询不是。我已将我正在使用的查询简化为几个表,以使其更简单。这只是我的SSRS数据集中的文本查询:

select   o.order_num,  ol.prod_num,  ol.prod_desc1 as com1, ol.prod_desc2 as com2
from [order] o
left outer join order_line ol on o.order_num = ol.order_num
where o.order_num = '09182272' and **(ol.prod_desc1 NOT LIKE '*%' and ol.prod_num <> 'C')**
UNION ALL
select    o.order_num,  ol.prod_num, ol.prod_desc1 as com1, ol.prod_desc2 as com2
from [order_history] o
left outer join order_history_line ol on o.order_num = ol.order_num
where o.order_num = '09182272' and (ol.prod_desc1 NOT LIKE '*%' and ol.prod_num <> 'C')

我不希望看到任何order_line(订单明细行),其中desc以“*”或prod_num =“C”开头。当我在Mgmt Studio中运行它时,我没有得到那些行 - 但是当我在SSRS中运行它时,它们会被返回。与2个查询的唯一区别在于,在SSRS中,o.order_num是一个参数,在这里我对它进行了硬编码。有任何想法吗?提前谢谢!!!

1 个答案:

答案 0 :(得分:0)

想通了 - 我必须清除缓存。发现这非常有帮助!