tag:blogger.com,1999:blog-5824660313967021040.post4062573145256242402..comments2022-03-26T08:56:28.677-07:00Comments on cfSearching: CF_SQL_DATE versus CreateODBCDateUnknownnoreply@blogger.comBlogger7125tag:blogger.com,1999:blog-5824660313967021040.post-90571878271836502672010-02-18T23:35:19.755-08:002010-02-18T23:35:19.755-08:00yes, i know, and i understand ur post, that's ...yes, i know, and i understand ur post, that's why i have sent mine :) so to say how it must be in the other case. which i was searching for in internetdidcihttps://www.blogger.com/profile/11019283431848702172noreply@blogger.comtag:blogger.com,1999:blog-5824660313967021040.post-3602844941106452922010-02-18T13:11:35.025-08:002010-02-18T13:11:35.025-08:00@didci,
I think your goal may be different than w...@didci,<br /><br />I think your goal may be different than what is described here. But yes, the proper cfsqltype to use can vary by database.<br /><br />Just keep in mind that unlike cf_sql_date, the type cf_sql_timestamp will submit both date and time. So if you are trying to submit the date portion <i>only</i>, you will have to do some manipulation before-hand.<br /><br />-LeighcfSearchinghttps://www.blogger.com/profile/11564374520734454860noreply@blogger.comtag:blogger.com,1999:blog-5824660313967021040.post-13756589473963713472010-02-18T02:46:01.881-08:002010-02-18T02:46:01.881-08:00I met the same problem, just i wanted it to insert...I met the same problem, just i wanted it to insert and the time part, and after research in internet i found out that the cfsqltype have to be cf_sql_timestamp.didcihttps://www.blogger.com/profile/11019283431848702172noreply@blogger.comtag:blogger.com,1999:blog-5824660313967021040.post-57699067165735947682008-02-15T11:56:00.000-08:002008-02-15T11:56:00.000-08:00Yes, you are right. But my goal here was a little ...Yes, you are right. But my goal here was a little different. I was looking for a simple way to pass dates only. So I could do comparisons like retrieve all records modified anytime today:<BR/><BR/>SELECT TestID, ModifiedDate<BR/>FROM Test<BR/>WHERE ModifiedDate >= {d '2008-02-15'}<BR/>AND ModifiedDate < {d '2008-02-16'}<BR/><BR/>It is easy using the CreateODBCDate function because it truncates any time portion of date/time values. However, I was unaware that using cfqueryparam with cf_sql_date did the same thing. Making these two statements roughly equivalent<BR/><BR/>SELECT TestID, ModifiedDate<BR/>FROM Test<BR/>WHERE ModifiedDate >= #CreateODBCDate(now())#<BR/>AND ModifiedDate < #CreateODBCDate(DateAdd("d", 1, now()))#<BR/><BR/>SELECT TestID, ModifiedDate<BR/>FROM Test<BR/>WHERE ModifiedDate >= <cfqueryparam value="#now()#" cfsqltype="cf_sql_date"><BR/>AND ModifiedDate < <cfqueryparam value="#DateAdd("d", 1, now())#" cfsqltype="cf_sql_date">cfSearchinghttps://www.blogger.com/profile/11564374520734454860noreply@blogger.comtag:blogger.com,1999:blog-5824660313967021040.post-86891456218652372532008-02-15T05:49:00.000-08:002008-02-15T05:49:00.000-08:00You might also try CreateODBCDateTime() it correct...You might also try CreateODBCDateTime() it correctly passes the date and time on every database that I have used.Steve Bryanthttps://www.blogger.com/profile/13743861364515748271noreply@blogger.comtag:blogger.com,1999:blog-5824660313967021040.post-63352752468044930442008-02-14T19:18:00.000-08:002008-02-14T19:18:00.000-08:00Yes. Copy + paste error. Thanks for letting me kno...Yes. Copy + paste error. Thanks for letting me know. I will update the code snippet.cfSearchinghttps://www.blogger.com/profile/11564374520734454860noreply@blogger.comtag:blogger.com,1999:blog-5824660313967021040.post-67726803854107384712008-02-14T18:42:00.000-08:002008-02-14T18:42:00.000-08:00In your second example should the datatype be "cf_...In your second example should the datatype be "cf_sql_date" instead of "cf_sql_timestamp"?Anonymousnoreply@blogger.com