SQL time comparison query?

I've been reading on-line about the difficulty of using time in sql.. because I'm having trouble myself and im not sure what approach i should be taking!.

I have an access database and im running sql queries through a web page returning the results, which works fine , but now I want to change in to base the returning results on a new field in the access database called Time. So i need to compare Time > currentsystemtime and i'll base an IF statement off that to display what i want. the Time field is simply things like '09:15' 09:20 etc.

What's the easiest way to do this?. i'm confused by the volume of text that's out there on this. if you can give me any pointers that would be really helpful.


more ▼

asked Apr 21, 2010 at 04:58 PM in Default

avatar image

1 1 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Firstly, this is a SQL Server forum, not an Access Forum. Other than that, in SQL Server, this would be simple as you would use DATEDIFF() on a datetime field (or on a time field in SQL 2008). I am not entirely sure, but the same type of functions should exist in Access.

more ▼

answered Apr 26, 2010 at 11:09 AM

avatar image

1.7k 2 3 6

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Apr 21, 2010 at 04:58 PM

Seen: 2520 times

Last Updated: Apr 21, 2010 at 04:58 PM

Copyright 2018 Redgate Software. Privacy Policy