[thelist] trimming db output (was: ASP question: Req...)

.jeff jeff at members.evolt.org
Thu Nov 29 18:32:36 CST 2001


rudy,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: rudy
>
> > varFieldOne = Trim(objRS("FieldOne"))
>
> okay, i appreciate that this is a "defensive
> programming" strategy, and in that sense it's good
> advice, but sheesh, the time to do the trimming, in
> fact the time to do *all* edits to ensure clean data,
> is on **input**
>
> if you do it on output you'll have redundant code all
> over the friggin place
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

if only it were so easy.  i've found that sybase adaptive server enterprise
(and probably ms sql too) returns a value of " " (single space) for a column
with a text datatype where the actual value in the database is "" (empty
string) and possibly null as well.  very annoying to say the least and can
throw lots of things off.

the interesting bit is that coldfusion returns null values from queries as
"" (empty strings).  so, in the application there's no distinction between
having a null value or having an empty string value.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > But I don't usually care about NULL specifically.
> > Blank, NULL, Spaces - they are all the same to me.
> > Kinda cavalier, I know. ;-)
>
> yup, cavalier is a good way to describe it
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

there are times when nulls are important to me, but in those instances, i'll
make sure to test the data on insert and if it's either a zero and being
inserted into a numeric type column or an empty string and being inserted
into a string type column i'll opt to insert null instead.  if my
application doesn't care about nulls (which is usually the case) i'll just
insert zeros or empty strings as fits.

just my 2¢,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list