Solved

Query of Queries and cfqueryparam

Posted on 2004-10-07
5
781 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 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