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
enddo the conditional branching earlier,
if @.Folio = '' --if account number is null
select * from tbl where param1 and param2 and param3
else
select * from tbl where param2 and param3
Quote:
Originally Posted by majidsql
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
No comments:
Post a Comment