Re: insert trouble...zero length

2009-06-16 Thread Peter Boughton
>Another quick question...I've noticed elsewhere, that it is common to set a >value to NULL. Technically, nulls in a relational database are a sign of badly designed database. (an 'optional' value should be represented with a 0..1 join to a separate table, or similar). In practise, especially wi

RE: insert trouble...zero length

2009-06-16 Thread Jason Fisher
That totally depends on your DB setup. If you have a column that does not allow NULL, then you have have send the empty string ('') if there's no value. If you have SQL code that tests Country IS NULL, then you may want to send NULL for that value in place of the empty string. Again, dependi

RE: insert trouble...zero length

2009-06-16 Thread Mark Fuqua MdProfinish
- From: Jason Fisher [mailto:ja...@wanax.com] Sent: Tuesday, June 16, 2009 2:56 PM To: cf-talk Subject: Re: insert trouble...zero length Actually, empty string simply breaks the Boolean check, it's the primary exception. cfif isBoolean(stringVar) ... will at least let it through only if it

Re: insert trouble...zero length

2009-06-16 Thread Jason Fisher
Boughton" Sent: Tuesday, June 16, 2009 2:48 PM To: "cf-talk" Subject: Re: insert trouble...zero length Nothing wrong with your mailing list ettiquette - I had to post manually (hof broke) and just got the subject wrong the first time, and posted again so it was correctly threaded. Anyh

Re: insert trouble...zero length

2009-06-16 Thread Peter Boughton
Nothing wrong with your mailing list ettiquette - I had to post manually (hof broke) and just got the subject wrong the first time, and posted again so it was correctly threaded. Anyhow, I'd still recommend adding a check against it being missing - unless you're 300% certain it will always be the

RE: insert trouble...zero length

2009-06-16 Thread Mark Fuqua MdProfinish
ect: Re: insert trouble...zero length Your problem there is the numeric ContactType field - if it is missing, you get an empty item between the two commas, which is invalid SQL syntax. You can solve it with cfqueryparam by setting the null property based on whether it contains a numeric value or not:

Re: insert trouble...zero length

2009-06-16 Thread Ian Skinner
Mark Fuqua MdProfinish wrote: > Sorry to ask, but does actually > suffice as a check for length or do I have to add = 0... LEN(TRIM(myquery.MyFieldName)) = 0> It does suffice do to the loosely typed nature of ColdFusion. Basically anything the evaluates to a ZERO can be considered false and a

Re: insert trouble...zero length

2009-06-16 Thread Jason Fisher
The exception is blank, which cannot be resolved as Boolean. So, will truly resolve either true or false. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lis

Re: insert trouble...zero length

2009-06-16 Thread Alan Rother
Yes, ColdFusion will implicitly treat anything as a boolean. As long as the it's not 0 it's considered true. =] -- Alan Rother Adobe Certified Advanced ColdFusion MX 7 Developer Manager, Phoenix Cold Fusion User Group, AZCFUG.org

Re: insert trouble...zero length

2009-06-16 Thread Peter Boughton
Your problem there is the numeric ContactType field - if it is missing, you get an empty item between the two commas, which is invalid SQL syntax. You can solve it with cfqueryparam by setting the null property based on whether it contains a numeric value or not: -- Peter Boughton //hybridc

Re: insert trouble...zero length

2009-06-16 Thread Charles Sheehan-Miles
ration? > > -Original Message- > From: Rob Parkhill [mailto:robert.parkh...@gmail.com] > Sent: Tuesday, June 16, 2009 1:42 PM > To: cf-talk > Subject: Re: insert trouble...zero length > > > You will have to make sure that the table you are inserting into can have a

Re: insert trouble...zero length

2009-06-16 Thread Charlie Griefer
On Tue, Jun 16, 2009 at 11:16 AM, Mark Fuqua MdProfinish < m...@mdprofinish.com> wrote: > > Sorry to ask, but does actually > suffice as a check for length or do I have to add = 0... LEN(TRIM(myquery.MyFieldName)) = 0> > actually that'd be (note the 'eq' not '=') :) Seems like you're saying

RE: insert trouble...zero length

2009-06-16 Thread Mark Fuqua MdProfinish
lto:alan.rot...@gmail.com] Sent: Tuesday, June 16, 2009 1:44 PM To: cf-talk Subject: Re: insert trouble...zero length There are several valid ways to handle this. In your destination table you can define a default value if none is provided, this of course does require you to do a CFIF around eac

Re: insert trouble zero length

2009-06-16 Thread Peter Boughton
Your problem there is the numeric ContactType field - if it is missing, you get an empty item between the two commas, which is invalid SQL syntax. You can solve it with cfqueryparam by setting the null property based on whether it contains a numeric value or not: ~~

RE: insert trouble...zero length

2009-06-16 Thread Mark Fuqua MdProfinish
ubject: Re: insert trouble...zero length You will have to make sure that the table you are inserting into can have a NULL as a value, or you will need to modify your code to look at each value and change any NULLs to either a space or a zero depending on the datatype you are inserting. HTH Rob O

Re: insert trouble...zero length

2009-06-16 Thread Alan Rother
There are several valid ways to handle this. In your destination table you can define a default value if none is provided, this of course does require you to do a CFIF around each item in your insert and you will need to check to see if the value you are about to insert has a length Of course i

Re: insert trouble...zero length

2009-06-16 Thread Alan Rother
There are several valid ways to handle this. In your destination table you can define a default value if none is provided, this of course does require you to do a CFIF around each item in your insert and you will need to check to see if the value you are about to insert has a length Of course if

Re: insert trouble...zero length

2009-06-16 Thread Rob Parkhill
You will have to make sure that the table you are inserting into can have a NULL as a value, or you will need to modify your code to look at each value and change any NULLs to either a space or a zero depending on the datatype you are inserting. HTH Rob On Tue, Jun 16, 2009 at 1:33 PM, Mark Fuqu

insert trouble...zero length

2009-06-16 Thread Mark Fuqua MdProfinish
Having trouble with the following code.having trouble with "zero length" values. The field in the database is empty and when it goes to insert it into another table, it chokes. Is there a way to set a " " value as default? Or do I have to do a cfif on each value? I'm sure I'm missing something