dlrickman
asked on
Default Option For Stored Procedure With IF - ELSE Condition
I need to set a default for the stored procedure to begin automatically at type if no value is supplied - Right now you need to specify 0 for the type condition to begin ----- So Basically the default will automatically check the IF(@Type=0) Condition and maybe a 1 or something else will skip that condition Completely - Any help will be appreciated
CREATE PROCEDURE Report].[Report2]
@StartDate datetime,
@EndDate datetime,
@Type tinyint
AS
BEGIN
set transaction isolation level read uncommitted;
declare @Type tinyint
declare @pStartDate datetime
declare @pEndDate datetime
declare @IsMonthlyReport bit
set @Type =0
set @pStartDate = @StartDate
set @pEndDate = @EndDate
BEGIN TRY
set @IsMonthlyReport = [CoRegReport].[rpt_IsMonth lyReport] (@pStartDate, @pEndDate)
IF(@Type= 0)
BEGIN
IF (@IsMonthlyReport = 0)
BEGIN
CREATE PROCEDURE Report].[Report2]
@StartDate datetime,
@EndDate datetime,
@Type tinyint
AS
BEGIN
set transaction isolation level read uncommitted;
declare @Type tinyint
declare @pStartDate datetime
declare @pEndDate datetime
declare @IsMonthlyReport bit
set @Type =0
set @pStartDate = @StartDate
set @pEndDate = @EndDate
BEGIN TRY
set @IsMonthlyReport = [CoRegReport].[rpt_IsMonth
IF(@Type= 0)
BEGIN
IF (@IsMonthlyReport = 0)
BEGIN
ASKER
okay but how do you get @Type to Begin as a default if no input parameter is specified
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This should help you.
Open in new window