Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Western part of Georgia, USA
    Posts
    123

    Unanswered: Passing Date to Stored procedure as variable

    Thanks in advance for your help!!!!!
    I have created a stored procedure that uses a date range for paramenters. As long as I hardcode the dates in (3/21/03, 3/25/03) I get no errors. As soon as I replace the dates with the variable name and try to run the sp, I get an error message that it can't convert string to date.

    It is my plan to call this sp from a web page and pass the date paramenters where they look like this 3/21/03

    Here is what I have
    @BegDate Smalldatetime,
    @EndDate Smalldatetime
    .....
    .....
    Where EntryDate BETWEEN '@BegDate' AND '@EndDate'

    Could someone please help me understand what I am missing?

    Thanks,
    Lee

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    you are searching where EntryDate is between the string '@BegDate' and the string '@EndDate' not the values contained in @BegDate and @EndDate.

    use Where EntryDate BETWEEN @BegDate AND @EndDate
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Oct 2002
    Location
    Western part of Georgia, USA
    Posts
    123

    Talking

    Thanks so much!!!!!! ' '

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •