I am using SQL Server 2008 and ColdFusion 9.1.2.
I have a query that has an integer field. I need to drop in an integer or a null, not a zero.
Right now, this is what I have:
<cfif LOCAL.MyValue eq "">
NULL ,
<cfelse>
<cfqueryparam cfsqltype="cf_sql_numeric" value="#LOCAL.MyValue#">,
</cfif>
What is the best way, or most efficient way, or most concise way to code this:
All in one line:
<cfqueryparam cfsqltype="cf_sql_numeric" value="#LOCAL.MyValue#" null="#NOT len(LOCAL.MyValue)#">
If it has length, it will set null=false.
If it hasn't got length, it will set null=true, and ignore what's in the value
attribute.
You may also want to add a trim() inside the len() too (eg if a user might possibly enter a space).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.