-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Here is a sample of a query that I use to delete old log entries from a table.
As you see I simply use the standard ODBC date formating. It seems to work fine.
The datatype is datetime, unless you are trying to use datepart for your query.
The only other problems I can see could be related to case-sensitivity, null-values, padded query values (hence use of trim) or use of keywords in columnnames, which can cause unpredictable results.
 
If you could provide a code fragment for the query, perhaps it will help.
 
- -alan
 

<cfquery name="getjoblist" datasource="#tcdb#">
    select JOB_ID, LOGRETENSION
    from TC_JOB_INPUT
</cfquery>
 
<cfloop query="getjoblist">
    <cfset rlogdate = "{ts '" & dateformat(now()-#getjoblist.LOGRETENSION#,"yyyy-mm-dd") & " 00:00:00'}">
 
    <cfquery name="logdel" datasource="#tcdb#">
            delete from TC_AGENT_LOG
            where JOB_ID = '#trim(getjoblist.JOB_ID)#'
            and LOGDATE < #rlogdate#
    </cfquery>
</cfloop>
 

- ----- Original Message -----
From: Mike
To: [EMAIL PROTECTED]
Sent: Monday, February 25, 2002 11:54 AM
Subject: [CFTALKTor] Time in Sybase
 

Hello All,
 
I wondering if anyone that is familiar with Sybase 7.0  could help me with this task.  I have a field that is a time.  I would like to check if the time that is in that field is greater or less than a set time value.
 
ie
 
Let's say I have a time in my database that is 8:30pm I would to check if that time is greater than 8:00pm
 
I just can't seem to get this to work.
 
Thanks
 
Mike
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Security 7.0.3
 
iQA/AwUBPHrvbyy8dBS/RM9kEQKICQCfYySMIcTD342sYdK4h7YP0lYfM8sAoLbw
kc5BJ/tOTxuwFRVK5O37bb4O
=VTL7
-----END PGP SIGNATURE-----

Reply via email to