Hi Friends,
I had a procedure to calculate month variance report , The variance calculated for month with compare to previous year price so made query with input fields @curr_mon_from,@curr_mon_to ,@last_yr_from,@last_yr_to
(here @curr_mon_from,@curr_mon_to these two input fields are current year variance taking month
@last_yr_from,@last_yr_to = these two fields are used to invoke the price of last year )
Now i wanna alter the procedure input fields only two fields i.e @curr_mon_from,@curr_mon_to.
from the input i wanna to subtract the year and take price of last year
ex:
create procedure test_variance
(
@curr_mon_from datetime
,@curr_mon_to datetime
as
begin
get the values for current billed item ,price
select
columns
into
#temp
from
tables
....
....
...
where billdate between @curr_mon_from and
@curr_mon_to
find the last yr price comparision
select
column
into
#temp1
from
table
.....
.....
.....
where dateadd(yy,datediff(yy,0,created_date)-1,0) between @curr_mon_from and
@curr_mon_to
end
its showing error ?
How to do that?
Guide me.