Ok, the title is probably confusing.
I need to use a case statement to calculate the amount of tax to deduct offa value.
This reduced value will be used in a Scalar function to calculate another value in a CTE in a Stored procedure..
How can I re-use this calculated column inside the scalar function?? I have tried the following.
paidminusIPT = case when country = "ireland" then (paid - 1) else paid end,
dbo.fnEarnedPrem(a,b,c,d,paidminusipt,e,f)
please note, this isn’t the exact code, just a quick reference..
Is this possible to do?
Regards.
You should use full expression instead of just column name:
or use CTE