Results 1 to 4 of 4

Thread: LOAD problem

  1. #1
    Join Date
    Aug 2012
    Posts
    2

    Unanswered: LOAD problem

    Hi, im having a problem loading a csv file.

    I have something like this in my file:

    CARGA INIC,2,"1 015",180163,1,0,0,201103,"VF",0,153.73,"MT10794418 ",20120713,114426,0,"",0,33,.0000

    The column delimiter is comma, and i have some of the String columns with ("").
    For some reazon when I run the following load script:

    LOAD CLIENT FROM test.csv of DEL modified by coldel, method P (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) messages log.msg replace into MYSCHEMA.MYTABLE (C1, C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C1 6,C17,C18,C19) nonrecoverable

    the process ends not loading any of the columns but the first one, with the complete line. It doesn't recognice the column delimiter.

    4381 CARGA INIC,2,"1 015" (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null)

    If I remove all the ("") from the file, it works fine.

    Any idea what could be the problem?

    thanks in advance.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Need to see the exact Table DDL per db2look:

    db2look -d <db-name> -t MYTABLE -e

    Don't ned to specify the schema name.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Aug 2012
    Posts
    2
    This is the table DDL.

    CREATE TABLE "MIGRACION"."PRESTACION_AS400" (
    "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (
    START WITH +1
    INCREMENT BY +1
    MINVALUE +1
    MAXVALUE +2147483647
    NO CYCLE
    CACHE 20
    NO ORDER ) ,
    "VDIDSE" VARCHAR(20) ,
    "VDCODP" INTEGER ,
    "VDPLAN" VARCHAR(10) ,
    "VDPRES" INTEGER ,
    "VDTIPR" SMALLINT ,
    "VDHONO" SMALLINT ,
    "VDCODR" INTEGER ,
    "VDFVIG" INTEGER ,
    "VDTVAL" VARCHAR(20) ,
    "VDCODV" INTEGER ,
    "VDVCAL" DECIMAL(15,2) ,
    "VDUSER" VARCHAR(20) ,
    "VDDATE" INTEGER ,
    "VDTIME" INTEGER ,
    "VDFEMO" INTEGER ,
    "VDTIMO" SMALLINT ,
    "VDFEML" INTEGER ,
    "VDFILI" BIGINT ,
    "VDVARA" DECIMAL(15,4) )
    COMPRESS YES
    IN "SDPAPRED" INDEX IN "SIPAPRED" ;

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    I believe that this will let the DB2 Identity column assign the first column value for you, which based on looking at the data, is apparently what you want:

    LOAD CLIENT FROM test.csv of DEL method P (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) messages log.msg replace into MYSCHEMA.MYTABLE nonrecoverable;

    This assumes all the data is comma-delimited and the character literals in your input file are surrounded by double-quotes. I would leave off the "modified by coldel," since I believe comma is the default, but try it if omitting it does not work.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •