Copy link to clipboard
Copied
Hi,
After that I installation CF10 FULL STANDART my codes in CF have a problem. Every queries with date not working and to working I have chande for <cfqueryparam ....>, but my application WEB is very big and this very difficult. What I have do? Hotfix? This is a BUG?
This is error:
Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value.
Thanks,
Eduardo.
Copy link to clipboard
Copied
Are your queries using <cfqueryparam>? Not only do they help prevent SQL injection, but they'll ensure that you get less issues with datatype conversions.
By the sound of it, you're attempting to send a string character and interpret it as a datetime. For example:
<cfset dateAsString = '2003-09-30' />
The above is a string object, even though its value looks like a date. But it's a string, often seen as a varchar by SQL. Instead, create an actual date object:
<cfset dateAsDate = createDate( 2003, 9, 30 ) />
That way, you can pass it in a <cfqueryparam> along with the proper cf_sql_type attribute, and it should be acceptable.