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

How to compare time in SQL?

Status
Not open for further replies.

iamanson

Programmer
Aug 17, 2001
42
0
0
AU
Hello,
I need to retrieve data within a specific time range,
e.g 9:00am to 3:00pm

It seems there is date function only, how about time?


 
select * from table2 where convert(varchar(10),dates,108) between '09:00:00' and '15:00:00'

Tablename is table2 with a datetime field column dates
 
By the way, where can you find what the 3rd parameter '108'
in 'convert(varchar(10),dates,108)' function means?

I can even find that in SQL's help.
 
if you search for convert in BOL it should be there

Matt

Brighton, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top