?
Solved

Query of Queries and cfqueryparam

Posted on 2004-10-07
5
Medium Priority
?
787 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Accepted Solution

by:
Renante Entera earned 472 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 464 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 464 total points
ID: 12259650
How about trying DateCompare or DateDiff instead of >=

Not all comparisons are supported in QoQ
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

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 …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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