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

Date Comparison

Status
Not open for further replies.

ghobbes98

Programmer
Feb 7, 2002
62
IE
I have a store procedure at the moment where I pass in a date and if the value in field is equal to this date I want to pass it back to the user. However I only pass in the date as "24/6/2002" but the date in the record might be
"24/6/2002 10.37.30" so it never returns back this value. So I was wondering is it possible to make a comparisson solely on the date part and not on the time as well
Thanks for any suggestions
G
 
Assume @datein is the input date.

Select *
From table_name
Where date_column >= @datein
And date_column < dateadd(d,1,@datein)

Alternate:

Select *
From table_name
Where convert(char(10), date_column, 103) = @datein Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains &quot;Suggestions for Getting Quick and Appropriate Answers&quot; to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top