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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Values

Status
Not open for further replies.
Dec 11, 2009
60
US
I have 2 parameters that I am passing in:

@StartDate datetime, @EndDate datetime

isnull(oc.updatedate,oc.createdate) between @startdate and @enddate

If I enter @StartDate = '2010-02-01
@EndDate = '2010-02-01

and the field value = 2010-01-21 11:41:00, no data returns?

What can I do to ensure that the records is pulled back?

Thanks,
 
Just do not use BETWEEN:
Code:
WHERE isnull(oc.updatedate,oc.createdate) >= @startdate and 
      isnull(oc.updatedate,oc.createdate) < (@enddate+1)
      -- See above this is just SMALLER THAN your End date
      -- plus one day



Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Code:
WHERE convert(varchar(10), YOUDATEFIELD, 101) between @startdate and @enddate

Dodge20
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top