From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Beth Bowden
Sent: Tuesday, September 12, 2006 7:18 AM
To: [email protected]
Subject: Re: [Reactor for CF] isLike on integer columnDoug,
two things:
First, "like" is used for character matching, not matching digits. "=" can be used with character or numerics. My guess is most databases would have problems with using like on a numeric field even if there wasn't error with the MAXLENGTH.
Actually like works fine with digits normally I have
written functions like this in the past... If anyone wants to tell me that this
is a bad idea I am definitely open to learning that type of
thing.
<cfquery name="qListRecords"
datasource="#getDsn()#">
SELECT
pre_id_field AS IdField
pre_string_field AS StringField
pre_int_field AS IntField
FROM
example_table
WHERE
1=1 <!--- so that the sql is syntactically correct even if there are no filter values --->
<!--- values to filter results --->
<cfif isDefined("arguments.FirstName") AND len(arguments.FirstName)>
AND pre_string_field =
<cfqueryparam
value="#arguments.StringField#"
cfsqltype="CF_SQL_VARCHAR"
maxlength="50"
null="#yesNoFormat( NOT len( StringField ) )#" />
</cfif>
<cfif isDefined("arguments.IntField") AND len(arguments.IntField)>
AND pre_int_field =
<cfqueryparam
value="#arguments.Status#"
cfsqltype="CF_SQL_INTEGER "
maxlength="2"
null="#yesNoFormat( NOT len( IntField ) )#" />
</cfif>
</cfquery>
SELECT
pre_id_field AS IdField
pre_string_field AS StringField
pre_int_field AS IntField
FROM
example_table
WHERE
1=1 <!--- so that the sql is syntactically correct even if there are no filter values --->
<!--- values to filter results --->
<cfif isDefined("arguments.FirstName") AND len(arguments.FirstName)>
AND pre_string_field =
<cfqueryparam
value="#arguments.StringField#"
cfsqltype="CF_SQL_VARCHAR"
maxlength="50"
null="#yesNoFormat( NOT len( StringField ) )#" />
</cfif>
<cfif isDefined("arguments.IntField") AND len(arguments.IntField)>
AND pre_int_field =
<cfqueryparam
value="#arguments.Status#"
cfsqltype="CF_SQL_INTEGER "
maxlength="2"
null="#yesNoFormat( NOT len( IntField ) )#" />
</cfif>
</cfquery>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
