![](/img/trans.png)
[英]SQL execution returns different results than execution directly in MS SQL Server Management Studio
[英]SSRS 2008 query returns different results in SSRS than directly in Management Studio
希望有人可以在這里提供幫助。 我在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')
我不想看到desc以“ *”或prod_num =“ C”開頭的任何order_line(訂單明細行)。 當我在Mgmt Studio中運行它時,我沒有得到這些行-但是,當我在SSRS中運行它時,它們會返回。 這兩個查詢的唯一區別是,在SSRS中,o.order_num是一個參數,在這里我對其進行了硬編碼。 有任何想法嗎? 提前致謝!!!
想通了-我必須清除緩存。 發現這很有幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.