I am writing one procedure and in that i am giving three inputs ie account number and from date and to date, and i will give any one inupt ie account number or (from and to dates).
So in the procedure i want to select records from table and in where condition depending on input ie account number or from and to dates, so i am not able to write query,
I will write the query here what i know, please corrct the query bcoz i am getting error
Select
*
From Mf_Tran_Reg
Where
mft_fundcd='ABN' and mft_purred='P'
if @Folio = '' --if account number is null
begin
and mft_procdate between @Fdate and @tdate
end
else
begin
and mft_accno= @Folio
end