If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Use time in Sql (Problem)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-25-04, 06:00
gop373 gop373 is offline
Registered User
 
Join Date: Aug 2004
Posts: 77
Angry Use time in Sql (Problem)

I have table name AAA.
Id ti
1 9:00:01AM
2 10:00:01AM
3 10:12:45AM
4 10:30:01AM

The type of time that I use in column ti is date/time hh:nn:ssAM/PM

<!--#include file="connect.asp"-->
<%
sql="select * from AAA where ti < '10:00:03AM' "
set rst5=server.createobject("adodb.recordset")
rst5.open sql,conn,1,3
if not rst5.eof then
response.write "OK"
end if
%>

When I run this code I got message "Data type missmatch"
Then I tried ti < 10:00:03AM It still didn't work!
Reply With Quote
  #2 (permalink)  
Old 09-25-04, 06:45
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
microsoft access?

try where ti < #10:00:03AM#
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 09-25-04, 08:15
gop373 gop373 is offline
Registered User
 
Join Date: Aug 2004
Posts: 77
Thank. It work.
But I still have question ?????
Assume that all of time was kept in variable which is array like this

tiorder2(t2)=rst5("tiorder")
tiorder2(t2)
How can I write it....

sql="select top 1 * from ("&namecompany2(i2)&") where price <= "&limitprice2(j2)&" and ti > #&tiorder2(t2)&#"

Not work

Note that tiorder2(t2) keep time
Reply With Quote
  #4 (permalink)  
Old 09-25-04, 08:32
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
i have no idea

perhaps you could ask that question in the ASP forum
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On