JaybeeinTekTips
Technical User
Hi all,
I've got a Sproc I'd like to alter so that it will accept input parameters, at the moment it ignores the dates I pass in (exec uspfraudreport '04-mar-2008', '05-mar-2008') and returns rows. Here's the code I've got so far, I've left out the irrelevant stuff at the end;
USE [AlvysReport]
GO
/****** Object: StoredProcedure [dbo].[uspTestFraudReport] Script Date: 03/18/2008 09:43:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,Woody Allen>
-- Create date: <17th March, 2008,>
-- Description: <Description,,>dbo.
-- =============================================
ALTER PROCEDURE [dbo].[uspFraudReport]
-- Add the parameters for the stored procedure here
(@StartTime datetime = null,
@EndTime datetime = null)
AS
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
Declare @DayBegining VarChar(50), @TodayDate VarChar(50)
Select @DayBegining = 'Monday'
Set @EndTime = Convert(varchar, getdate(),101)
Set @TodayDate = DateName(dw,@EndTime)
If @DayBegining = @TodayDate
Set @StartTime = DateAdd(dd, -3, @EndTime)
Else
Set @StartTime = DateAdd(dd, -1, @EndTime)
I've got a Sproc I'd like to alter so that it will accept input parameters, at the moment it ignores the dates I pass in (exec uspfraudreport '04-mar-2008', '05-mar-2008') and returns rows. Here's the code I've got so far, I've left out the irrelevant stuff at the end;
USE [AlvysReport]
GO
/****** Object: StoredProcedure [dbo].[uspTestFraudReport] Script Date: 03/18/2008 09:43:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,Woody Allen>
-- Create date: <17th March, 2008,>
-- Description: <Description,,>dbo.
-- =============================================
ALTER PROCEDURE [dbo].[uspFraudReport]
-- Add the parameters for the stored procedure here
(@StartTime datetime = null,
@EndTime datetime = null)
AS
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
Declare @DayBegining VarChar(50), @TodayDate VarChar(50)
Select @DayBegining = 'Monday'
Set @EndTime = Convert(varchar, getdate(),101)
Set @TodayDate = DateName(dw,@EndTime)
If @DayBegining = @TodayDate
Set @StartTime = DateAdd(dd, -3, @EndTime)
Else
Set @StartTime = DateAdd(dd, -1, @EndTime)