macromedia.coldfusion.advanced_techniques
[Top] [All Lists]

Re: SQL Between dates

Subject: Re: SQL Between dates
From: Ian Skinner
Date: Tue, 17 Jun 2008 12:12:34 -0700
Newsgroups: macromedia.coldfusion.advanced_techniques


What type of field is 'TODate'? Is it a date field, a string field, a number field? You may be having a problem with data matching. I do not know if SQL server will automatically convert a date string (like you are providing) to a date value.

You would probably be better served using <cfqueryparam...> to make sure the data types match.

I.E. TODate BETWEEN <cfqueryParam value="#arguments.startDate#" cfsqltype="cf_sql_date"> AND <cfqueryParam value="#arguments.endDate#" cfsqltype="cf_sql_date">

Of course you would want to make sure the sql type parameter matches the actual type of the database column.

<Prev in Thread] Current Thread [Next in Thread>