x

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.

more ▼

asked Apr 21 '10 at 04:58 PM in Default

Amendir gravatar image

Amendir
1 1 1 1

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

1 answer: sort newest

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 '10 at 11:09 AM

RickD gravatar image

RickD
1.7k 1 1 4

(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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

SQL Server Central

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

Topics:

x1933
x235
x91
x48
x28

asked: Apr 21 '10 at 04:58 PM

Seen: 2028 times

Last Updated: Apr 21 '10 at 04:58 PM