Solved

Query of Queries and cfqueryparam

Posted on 2004-10-07
5
779 Views
Last Modified: 2013-12-24
Given this piece of code:

<cfquery name="GetNewHiresYear" dbtype="query">
SELECT HireDate
FROM GetOrderData
WHERE JobFamilyID = #Val( tFamID )#
AND #tColName# = '#tLbl#'
AND HireDate >= <cfqueryparam value="#DateFormat( CreateDate( DatePart( "yyyy", Now() ), 1, 1 ), "mm/dd/yyyy" )#" cfsqltype="CF_SQL_DATE">
</cfquery>

Why does the date comparison not work? Here is the debugging output:

SELECT HireDate
FROM GetOrderData
WHERE JobFamilyID = 40
AND EthnicOrigin = 'Native'
AND HireDate >= ?
                                                
Query Parameter Value(s) -
Parameter #1(CF_SQL_DATE) = {ts '2004-01-01 00:00:00'}
0
Comment
Question by:radleydp
5 Comments
 
LVL 14

Accepted Solution

by:
Renante Entera earned 118 total points
ID: 12255328
Hello radleydp!

How about changing your code :
   AND HireDate >= <cfqueryparam value="#DateFormat( CreateDate( DatePart( "yyyy", Now() ), 1, 1 ), "mm/dd/yyyy" )#" cfsqltype="CF_SQL_DATE">

With this :
  AND HireDate >= <cfqueryparam value="#CreateODBCDate(Now())#" cfsqltype="CF_SQL_DATE">

Then by the way, what database are you using ?


Regards!
eNTRANCE2002 :-)
0
 
LVL 17

Assisted Solution

by:Tacobell777
Tacobell777 earned 116 total points
ID: 12255416
use cf_sql_timestamp instead
its a bug - not sure why they still have not fixed it..
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 116 total points
ID: 12259650
How about trying DateCompare or DateDiff instead of >=

Not all comparisons are supported in QoQ
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now