Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2008
    Posts
    3

    Unanswered: DB2 -IMPORT FILE , How to add validation

    Hi All Gurus,

    I am trying to load a CSV file from my PC (windows XP) to Db2 v8.1 (UNIX server). The file is an excel sheet (user input) converted to a CSV. I am able to load the file to the table but the problem I am facing is that there are some null rows in the file which are getting inserted in the table (like all columns are null or have spaces). Is there a way I can put a validation criteria so that it checks for a null row before it loads, as I cannot restrict on the row count .


    -------Code being used ----

    IMPORT FROM 'C:/data/DD Limits Dec 2007.csv' OF DEL COMMITCOUNT AUTOMATIC
    SKIPCOUNT 2
    MESSAGES c:/data/import_dd_limits.log
    REPLACE INTO DDN.DD_LIMITS
    (Region,Pricing,Name,Account,Amount);

    -----------------
    I am very new to DB2 so don’t have any Idea what I should be looking at , I tried searching the documentation but couldn’t find any thing good ,any help in this direction would be great .

    Thanks in advance-
    -Raj

  2. #2
    Join Date
    Jan 2008
    Posts
    3

    Opted for the work arround

    Hi All ,

    well I opted for the work around by making one of the columns not nullable so that utility rejects the data for that row , but still it would be great to know other options

    - thanks

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    There is nothing on the IMPORT or LOAD command to not insert a completely null row. Maybe if you have a column in the table that is defined as NOT NULL, then the row cannot be imported.

    Andy

  4. #4
    Join Date
    Jan 2008
    Posts
    3
    Thanks Andy for the response .. This solution works I have tried out

  5. #5
    Join Date
    Jan 2010
    Posts
    1
    You can use Flat File Checker to validate all you import files. It has all common validation rules. Once you have created the data specification in it you can validate your data through command line.

Posting Permissions

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