I'm trying to create a calculated column using other columns and a variable, but it isn't working, here is my code:
SET @rate = 0.21;
select 'dbr.calc','Lost Net Comp', '([Total_Calls] * @rate) - [phoneSale]';
If I change the @rate variable by the value, then it works:
select 'dbr.calc','Lost Net Comp', '([Total_Calls] * 0.21) - [phoneSale]';
I want to mantain the variable since this is a big report and uses the @rate value multiple times, I want to have declared only once so it would be easy to change in the future.
Any ideas how the calculation can work using variables instead of fixed values?