David Adlington
David Adlington

Reputation: 666

SSRS reading date type as nvarchar

I have created a query that uses a decimal as a paramater in SSRS. Code below (@TrueDemand) when running this on my local PC, via the Data page the query throws an error of trying to convert nvarchar to int. However when running it in Preview or even publishing the report to the web it runs fine :(

Error

Its very frustrating. Any ideas?

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

Upvotes: 0

Views: 387

Answers (1)

jimconstable
jimconstable

Reputation: 2388

Have you tried explicitly casting to decimal all the variables on that line.

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

Upvotes: 1

Related Questions