See, there you go. Phillip knows how to do emotion.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Phillip Senn Sent: Friday, March 03, 2006 12:49 PM To: [email protected] Subject: RE: [CFCDev] OT: Empty fields passed as integer parameters THAT'S WHAT I'M TALKING ABOUT, BABY! Booyah! From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Stoner Sent: Friday, March 03, 2006 10:31 AM To: [email protected] Subject: Re: [CFCDev] OT: Empty fields passed as integer parameters Since this is an integer field, if you want a zero you can just use the val() function: <cfprocparam type="in" cfsqltype="cf_sql_integer" value="#val( FORM.CustNo )#"> If you want a null you can use the val function as well (in any flavor you like): <cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" value="#val( FORM.CustNo )#" null="#val( FORM.CustNo)#"> <cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" value="#val( FORM.CustNo )#" null="#yesNoFormat( val( FORM.CustNo ) )#"> <cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" value="#val( FORM.CustNo )#" null="#yesNoFormat( val( FORM.CustNo ) EQ 0 )#"> On 3/3/06, Phillip Senn <[EMAIL PROTECTED]> wrote: It's too bad adding zero doesn't work: <cfprocparam type="in" cfsqltype="cf_sql_integer" value="#FORM.CustNo+0#"> ________________________________________ From: Phillip Senn [mailto:[EMAIL PROTECTED] Sent: Friday, March 03, 2006 9:51 AM To: ' [email protected]' Subject: RE: [CFCDev] OT: Empty fields passed as integer parameters I think what everyone has agreed on is this, or something very similar to it: <cfstoredproc procedure="myProcedure" datasource="#Application.DSN#"> <cfprocparam type="in" cfsqltype="cf_sql_integer" value="#FORM.CustNo#" null="#Len(form.CustNo) is 0#"> </cfstoredproc> One problem with this technique is when fields are defined as NOT NULL. In that case, I'll have to write it as: <cfstoredproc procedure="myProcedure" datasource="#Application.DSN#"> <cfif Len(FORM.CustNo) EQ 0> <cfprocparam type="in" cfsqltype="cf_sql_integer" value="0"> <cfelse> <cfprocparam type="in" cfsqltype="cf_sql_integer" value="#FORM.CustNo#"> </cfif> </cfstoredproc> Yuck. An alternative is to move the burden to the stored procedure with ISNULL(@CustNo,0) I think I'll use the CFIF-CFELSE construct because: If a field is explicitly designed NOT NULL, it's telling me that field doesn't want to have anything to do with NULL. It doesn't even want to hear about it. Let's not get into the whole Null debate since this is a list for cfc development, and Null has been discussed at length before (unless someone wants to post a link to a discussion about handling nulls in ColdFusion). The archive for cfcdev can be found at: http://www.mail-archive.com/[email protected]/ ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone ( www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
