2011-06-18 91 views
0

我已經創建了一個查詢,它在SSRS中使用了一個小數作爲參數。下面的代碼(@TrueDemand)在我的本地PC上運行時,通過數據頁面查詢會引發錯誤trying to convert nvarchar to int。 然而,在預覽運行它,甚至發佈報告到網絡時,它運行正常:(SSRS閱讀日期類型爲nvarchar

Error

它非常令人沮喪的。任何想法?

SELECT AD.LogDate, 
    AD.Location, 
    AD.FunctionDescription as Func, 
    AD.Offered, 
    AD.Handled, 
       AD.Handled + ((AD.Offered - AD.Handled) * @TrueDemand) as TrueDemand, 
    AD.Handled30, 
    AG.SignedIn, 
    AG.Available, 
    AG.WorkloadSecs, 
    AG.FullAHTSecs 

FROM  dbo.vw_ApplicationDetail_Minus15mins AD 
INNER JOIN dbo.vw_AgentGroupDetail AG ON 
    AD.Logdate = AG.Logdate AND 
    AD.Location = AG.Location AND 
    AD.FunctionDescription = AG.FunctionDescription 

WHERE AD.Logdate between @Logdate AND dateadd(d,1,@Logdate) AND 
     AD.Location = @Location AND 
     AD.FunctionDescription = @Function 

ORDER BY AD.Logdate 

回答

1

您是否嘗試過明確鑄造成十進制所有的變量在這條線上。

cast(AD.Handled as Decimal) + ((Cast(AD.Offered as Decimal) - Cast(AD.Handled as Decimal)) * Cast(@TrueDemand as Decimal)) as TrueDemand 
+0

是的,這個工程其實只是我需要投的參數。有沒有人有任何想法w hy SSRS會讀取0.50的值作爲nvarchar?在進一步的調查中,它讀取了很好的內存。感覺像一個錯誤? –

+0

不!它沒有工作,將它轉換爲Decimal只會返回一個Intger。 I.E 0.50 = 1.鑄造浮動工作。困惑:( –