Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem altering a sproc to take parameters

Status
Not open for further replies.

JaybeeinTekTips

Technical User
Nov 5, 2004
20
GB
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)
 
Your code resets the values of endtime and starttime why input them if you are going to reset them?

"NOTHING is more important in a database than integrity." ESquared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top