i wrote the stored procedure like as below .it was executed successfully.no w i want to write if conditions for this stored procedure at check all conditions if i give fromdate and todate this is first case.second is not give fromdate and give todate.third give fromdate and not give todate.if i not give fromdate and not give todate.
how to write code for above cases?
stored procedure:
set ANSI_NULLS ON
set QUOTED_IDENTIFI ER ON
go
alter PROCEDURE [dbo].[sp_selectgunnie itemtran]
(@fromdate datetime,@todat e datetime)
--(@fromdate datetime,@todat e datetime,@Date datetime,@Issue _No int,@Item_Desc varchar(50),@Qu antity int,@Agent_name varchar(50),@Ag ent_Code int)
AS
BEGIN
select
riq.Issue_No,ri q.Item_Desc ,riq.Quantity ,ri.Date,
a.Agent_name,a. Agent_Code
from
Rice_Agent_Mast er a,Rice_Issues ri,Rice_Issues_ Qty riq
where
ri.Date between @fromdate and @todate
and
riq.Agent_Code= a.Agent_Code
how to write code for above cases?
stored procedure:
set ANSI_NULLS ON
set QUOTED_IDENTIFI ER ON
go
alter PROCEDURE [dbo].[sp_selectgunnie itemtran]
(@fromdate datetime,@todat e datetime)
--(@fromdate datetime,@todat e datetime,@Date datetime,@Issue _No int,@Item_Desc varchar(50),@Qu antity int,@Agent_name varchar(50),@Ag ent_Code int)
AS
BEGIN
select
riq.Issue_No,ri q.Item_Desc ,riq.Quantity ,ri.Date,
a.Agent_name,a. Agent_Code
from
Rice_Agent_Mast er a,Rice_Issues ri,Rice_Issues_ Qty riq
where
ri.Date between @fromdate and @todate
and
riq.Agent_Code= a.Agent_Code
Comment