Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
RE: Loade: default value that is not 'null' when importing?
From: Schildberg, Steffen (steffen.schildbergsap.com)
Date: Tue May 25 2004 - 02:24:23 CDT
Zavier Sheran [mailto:infozavier.net] wrote:
> I have to import a csv dataset and some fields that are
> indexed in the table are not in the csv data.
> Loader gives an error stating that those fields are required.
> is there a way to import the data and set for the index
> fields that are not available a default value?
> DATALOAD TABLE DBA.cars_used
> record_id 1 DEFAULT NULL
> dealer_name 2 DEFAULT NULL
> ..... (cut)
> car_make_display 10 DEFAULT NULL
> car_model_display 11 DEFAULT NULL
> INFILE 'cars_used.txt' COMPRESSED
> ASCII SEPARATOR '|'
> DELIMITER ''
> I would like to add a few lines like
> car_make_code DEFAULT '99'
> car_model_code DEFAULT '99'
> to set a value of 99 to columns that are not represented in
> the csv data
> What is the correct syntax, if this functionality is
> available at all? I could not find anything in the docs...
It depends highly on the version of the Loader you use. Starting with
version 7.4.03.32 the Loader loads arbitrary constants with
the following syntax (although it had been in the Loader for much
longer but due to bugs didn't work the right way :-( ):
DATALOAD TABLE DBA.cars_used
record_id 1 DEFAULT NULL
dealer_name 2 DEFAULT NULL
car_make_display 10 DEFAULT NULL
car_model_display 11 DEFAULT NULL
INFILE 'cars_used.txt' COMPRESSED
ASCII SEPARATOR '|'
Concerning the docs (I know it's sometimes hidden) see:
SAP DB Team
SAP Labs Berlin
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb