question

Amendir avatar image
Amendir asked

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.

thanks.

sql-server-2005databasedatetimemicrosoft-accesstime
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
RickD avatar image
RickD answered

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.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.