Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Query of Queries and cfqueryparam

Posted on 2004-10-07
5
Medium Priority
?
790 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

597 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