Re: [phplib] anybody knows a way? From: fabrizio.ermini <email protected>
Date: 04/17/01

On 14 Apr 2001, at 17:17, Pfeiffer Bau + Immo wrote:

> in englisch:
> in a database I defined in a table a column type as decimal 9,2. Now I
> imported datas with loadfile, in this column 'decimal 9,2' should be no
> value, but after importing the datas, in this field is a '0' instead of
> nothing, how it should be. Has anybody a solution?
>

Don't know which DB you are using, however it's pretty common for
DBMS out there to consider an empty string, or an empty field in a
csv file, as a zero if the field is numeric. Generally, if you want to
import NULLs from a flat file, you have to specify them as such in
the file itself. Coding varies from DB to DB but often it's the string
"NULL" in capitals or the pseudo escape "\N".

i.e., if the flat file is so:
...
1,2,'pippo',,'foo','bar';
...

and the 4th column is numeric, it will contain a 0. Correct way to
create the file would be something like that:

...
1,2,'pippo',NULL,'foo','bar';
...

HTH, bye

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Fabrizio Ermini Alternate E-mail:
C.so Umberto, 7 faermini <email protected>
loc. Meleto Valdarno Mail on GSM: (keep it short!)
52020 Cavriglia (AR) faermini <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>