Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hameed
Starting Member
40 Posts |
Posted - 2001-10-03 : 16:24:09
|
| I am passing a start date and and end date to a stored procedure. I want to extract records from the table when I compare these two dates to a date value in one of the fields. In other words, I want to return all records that fall between and include the start and end data I am passing to the stored proc. This stored proc works wonderfully when the month is the same. However the problem I have is when the moths are different. Please suggest a better way of doing this, or pointing out to me what is wrong with my stored proecedure. Thanks. Here is the stored proc:CREATE PROCEDURE SearchData @pStartDate smalldatetime,@pEndDate smalldatetimeASSELECT CurrencyID, Ticket, Currency, Amount, BuySell, OpenDate, OpenPrice, CloseDate, ClosePrice, GrossPandL, Commission, NetPandL, InputDateFROM CurrencyWHERE convert(varchar(10),OpenDate,102) between convert(varchar(10),@pStartDate,102) and convert(varchar(10),@pEndDate,102)GO |
|
|
|
|
|
|
|