Showing posts with label hardcode. Show all posts
Showing posts with label hardcode. Show all posts

Friday, March 23, 2012

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,
Leeyou 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|||Thanks so much!!!!!! ' '