Actually, what I use is:

<cfqueryparam cfsqltype="CF_SQL_INTEGER" null="#not len(myVariable)#"
value="#myVariable#" />

It's a true false equation and runs faster than field is "".

Also someone mentioned that it doesn't matter, I have experienced where
it does.  I put null="true" and a value="whatever I want" and it put
null in the database, not my value.

Steve.


-----Original Message-----
From: COLLIE David [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 27, 2006 12:03 PM
To: CF-Talk
Subject: RE: Insert best practice


> I was wondering which one are best practices when doing a db 
> insert/update:
> <cfqueryparam value="#lfield#" cfsqltype="CF_SQL_INTEGER" 
> null="#iif((filed eq ""), de("yes"), de("no"))#" />,
> 
> or
> <cfif val (field) gt 0)>
>          <cfqueryparam value="#lfield#" 
> cfsqltype="CF_SQL_INTEGER" /> <cfelse>
>        null
> </cfif>

Def the first one in my opinion.

Roll your own isNull() UDF to get rid of the IIF.  You will get to reuse
it a few times I promise!

(you could use isEmpty off of CFLIB IIRC as well if your NULL choices
are pretty limited)



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254412
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to