Go Premium for a chance to win a PS4. Enter to Win


How to compare TimeValues ???

Posted on 1998-10-05
Medium Priority
Last Modified: 2010-03-19
I try to compare 2 differtent TimeValues via "<" ">" like

Select * from Time where time.time1 < 'enteredTime' .
I did it from my code in Visual Basic , but get always an ODBC - called faild ! Hope someone can help me ... ThanX
Question by:kaber
  • 2

Expert Comment

by:Victor Spiridonov
ID: 1090380
'ODBC call failed ' is only the first part of ther error ,what does full text says?
Also, run SQL Trace when executing this query,and see what is actualy being sent to the server (and post here).

Accepted Solution

TheAnswerMan earned 60 total points
ID: 1090381
Do this..

ls_SQL = "SELECT * FROM TimeTable WHERE " _
        & " TimeTable.Time1 < " _
        & "'" & format(enteredTime,"HH:MM:SS") & "'"

'or whatever format your Time1 field is..

Expert Comment

by:Victor Spiridonov
ID: 1090382
The proposed answer will not work. In SQL Server date and time are stored in the same field.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question