according to mysql doc and convention,
"set the default value appropriate for the column type.  This is 0 for numeric types, 
the empty string(' ') for string types, and the "zero" value for date and time types.

unless you see values in storing them in numeric types, perhaps store them as string 
type to achieve the desired affects?

in perl scalar variable works interchangeable between two types, thus no problem.  not 
sure about php.

:)

-----Original Message-----
From: "NIPP, SCOTT V \(SBCSI\)" <[EMAIL PROTECTED]>
Date: 09/16/04 12:59 PM
To: "S P" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
Subject: RE: MySQL data matching error...

        I am using phpMyAdmin to simplify the DB administration, but yes
I have setup the table as you are suggesting.  The problem as I see it
is that the value of the incoming data is ' ', and when this is inserted
into the database it becomes '0'.  The problem is if I test against this
value now, the input value is still ' ' and the database is '0'.  
        The goal is a change log on this table.  I am accomplishing this
by reading each line of the incoming file and doing a select on the key
field to grab the database entry as an array.  Then I work through the
database array comparing it's contents to the incoming file data array.
If a difference is discovered, then the database array is populated into
the change log table and the incoming file data array is populated into
the live table.  Obviously this strange behavior is disrupting this
change log testing.
        Thanks again for any feedback.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-----Original Message-----
From: S P [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 16, 2004 2:27 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: MySQL data matching error...


Hi,
Not sure what you're trying to achieve,

Are you trying to have a blank(' ') instead of '0'?
or are you trying to actually store as 'NULL'?

Have you tried 
create table table_name (
field datatype(size) default as 'NULL',
...
)
?


--- "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> wrote:

>       I am having a problem in that if a field is blank,
> it is getting
> put into the database as a '0' rather than 'NULL'. 
> The table is setup
> to both allow NULL values in this field as well as
> NULL being the
> default value.  The problem is that on a few entries
> the field is
> actually empty, but the database is entering the
> value into the table as
> a '0' as mentioned above.  Does this problem sound
> familiar to anyone?
> 
> Scott Nipp
> Phone:  (214) 858-1289
> E-mail:  [EMAIL PROTECTED]
> Web:  http:\\ldsa.sbcld.sbc.com
> 
> 
> 






 
These words brought to you by Ogo.  Find out more at www.ogo.com


Reply via email to