Callum McGillivray wrote:
\When I am doing an update, do I reall have to use the following line
of code to set null values ?
UPDATE customer
SET name = <cfif
arguments.CustomerBean.getName() is ''><cfqueryparam
cfsqltype="cf_sql_varchar" value="#arguments.CustomerBean.getName()#"
maxlength="40" null="yes" /><cfelse><cfqueryparam
cfsqltype="cf_sql_varchar" value="#arguments.CustomerBean.getName()#"
maxlength="40" null="no" /></cfif>,
It seems a bit cumbersome and I was wondering if there is a better way.
Try this Callum:
<cfqueryparam cfsqltype="cf_sql_varchar"
value="#arguments.CustomerBean.getName()#" maxlength="40" null="#NOT
len(arguments.Customerbean.getName())#" />
#NOT len(arguments.Customerbean.getName())# will produce = NO when the
string has GT 0 characters
#NOT len(arguments.Customerbean.getName())# will produce = YES when the
string EQ 0 characters in length (or essentially NULL in this case)
Best,
.Peter
--
Peter J. Farrell :: Maestro Publishing
blog :: http://blog.maestropublishing.com
email :: [EMAIL PROTECTED]
Create boilerplate beans!
Check out the Mach-II Bean Creator - free download.
http://blog.maestropublishing.com/mach-ii_beaner.htm
----------------------------------------------------------
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).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]