RE: NULL or 0
That's true, but there may be times when NULL is appropriate - and not ev ery column has an index. -Original Message- From: Zac Spitzer [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 11:37 AM To: CF-Talk Subject: Re: NULL or 0 Mark A. Kruger - CFG wrote: >Come to think of it - if you are using MSSQL you can use the "ISNULL( )" >function to acheive that result - it replaces a null with a default valu e > as >in: > >SELECT IsNull(MyintColumn,0) AS MyintColumn > of course design wise 0 can be better than NULL as null values are not indexed by RDBM's z __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: NULL or 0
You can use YesNoFormat to force-boolean and empty string to false. > > If you are using CF, remember that NULL is returned as a zero length > stri > > ng > > ( ' ') which is not the same as NULL. If you have code that evaluates > or > > calculates in CF using that column, you either must default to a > numeric > > value or validate the numericity (is that a word) in the application > code. > > For this reason I usually default to 0 rather than NULL. When you do > thi > > s, > > you have the added benifit in CF of being able to use the value as if > it > > were a boolean, as in: > > > > > > If the column is NOT 0, this executes > > > > > > If the column IS 0, this executes > > > > > > > > I find that useful in certain situations. > > > > Mark > > > > -Original Message- > > From: Rice, John J [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 31, 2002 7:34 AM > > To: CF-Talk > > Subject: NULL or 0 > > > > > > For an Integer or Number field, does it make more sense to default > values > > to > > NULL or 0? > > > > When used for calculations, a column with NULL could cause a problem > (eg. > > NULL * 2). > > Columns with NULL will be ignored in and SQL count, but columns with a > 0 > > will be counted. > > > > Is this right? Are there other reasons to favor one use or the other? > > > > "NULL programmers are easy to find and once found can be fired since > they > > are not needed." > > > > > __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: NULL or 0
Mark A. Kruger - CFG wrote: >Come to think of it - if you are using MSSQL you can use the "ISNULL( )" >function to acheive that result - it replaces a null with a default value > as >in: > >SELECT IsNull(MyintColumn,0) AS MyintColumn > of course design wise 0 can be better than NULL as null values are not indexed by RDBM's z __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: NULL or 0
Come to think of it - if you are using MSSQL you can use the "ISNULL( )" function to acheive that result - it replaces a null with a default value as in: SELECT IsNull(MyintColumn,0) AS MyintColumn -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 9:07 AM To: CF-Talk Subject: Re: NULL or 0 There is a nice custom tag for this on the developers exchange, I believe they have it set to change all ' ' values to NULL if found, but easy to change to 0. it is called NULL_VALIDATE. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: "Mark A. Kruger - CFG" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, January 31, 2002 9:51 AM Subject: RE: NULL or 0 > If you are using CF, remember that NULL is returned as a zero length stri > ng > ( ' ') which is not the same as NULL. If you have code that evaluates or > calculates in CF using that column, you either must default to a numeric > value or validate the numericity (is that a word) in the application code. > For this reason I usually default to 0 rather than NULL. When you do thi > s, > you have the added benifit in CF of being able to use the value as if it > were a boolean, as in: > > > If the column is NOT 0, this executes > > > If the column IS 0, this executes > > > > I find that useful in certain situations. > > Mark > > -Original Message- > From: Rice, John J [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 31, 2002 7:34 AM > To: CF-Talk > Subject: NULL or 0 > > > For an Integer or Number field, does it make more sense to default values > to > NULL or 0? > > When used for calculations, a column with NULL could cause a problem (eg. > NULL * 2). > Columns with NULL will be ignored in and SQL count, but columns with a 0 > will be counted. > > Is this right? Are there other reasons to favor one use or the other? > > "NULL programmers are easy to find and once found can be fired since they > are not needed." > > __ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: NULL or 0
There is a nice custom tag for this on the developers exchange, I believe they have it set to change all ' ' values to NULL if found, but easy to change to 0. it is called NULL_VALIDATE. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: "Mark A. Kruger - CFG" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, January 31, 2002 9:51 AM Subject: RE: NULL or 0 > If you are using CF, remember that NULL is returned as a zero length stri > ng > ( ' ') which is not the same as NULL. If you have code that evaluates or > calculates in CF using that column, you either must default to a numeric > value or validate the numericity (is that a word) in the application code. > For this reason I usually default to 0 rather than NULL. When you do thi > s, > you have the added benifit in CF of being able to use the value as if it > were a boolean, as in: > > > If the column is NOT 0, this executes > > > If the column IS 0, this executes > > > > I find that useful in certain situations. > > Mark > > -Original Message- > From: Rice, John J [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 31, 2002 7:34 AM > To: CF-Talk > Subject: NULL or 0 > > > For an Integer or Number field, does it make more sense to default values > to > NULL or 0? > > When used for calculations, a column with NULL could cause a problem (eg. > NULL * 2). > Columns with NULL will be ignored in and SQL count, but columns with a 0 > will be counted. > > Is this right? Are there other reasons to favor one use or the other? > > "NULL programmers are easy to find and once found can be fired since they > are not needed." > > __ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: NULL or 0
Ron and Mark, Thank You. This is the feedback I was looking for. -John "NULL programs are both self-documenting for clarity and self-concealing for security." -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 12:52 PM To: CF-Talk Subject: RE: NULL or 0 If you are using CF, remember that NULL is returned as a zero length stri ng ( ' ') which is not the same as NULL. If you have code that evaluates or calculates in CF using that column, you either must default to a numeric value or validate the numericity (is that a word) in the application code. For this reason I usually default to 0 rather than NULL. When you do thi s, you have the added benifit in CF of being able to use the value as if it were a boolean, as in: If the column is NOT 0, this executes If the column IS 0, this executes I find that useful in certain situations. Mark -Original Message- From: Rice, John J [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 7:34 AM To: CF-Talk Subject: NULL or 0 For an Integer or Number field, does it make more sense to default values to NULL or 0? When used for calculations, a column with NULL could cause a problem (eg. NULL * 2). Columns with NULL will be ignored in and SQL count, but columns with a 0 will be counted. Is this right? Are there other reasons to favor one use or the other? "NULL programmers are easy to find and once found can be fired since they are not needed." __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: NULL or 0
If you are using CF, remember that NULL is returned as a zero length stri ng ( ' ') which is not the same as NULL. If you have code that evaluates or calculates in CF using that column, you either must default to a numeric value or validate the numericity (is that a word) in the application code. For this reason I usually default to 0 rather than NULL. When you do thi s, you have the added benifit in CF of being able to use the value as if it were a boolean, as in: If the column is NOT 0, this executes If the column IS 0, this executes I find that useful in certain situations. Mark -Original Message- From: Rice, John J [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 7:34 AM To: CF-Talk Subject: NULL or 0 For an Integer or Number field, does it make more sense to default values to NULL or 0? When used for calculations, a column with NULL could cause a problem (eg. NULL * 2). Columns with NULL will be ignored in and SQL count, but columns with a 0 will be counted. Is this right? Are there other reasons to favor one use or the other? "NULL programmers are easy to find and once found can be fired since they are not needed." __ Why Share? Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: NULL or 0
Nulls have always caused me a problem... I avoid them like the plauge... __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists