If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 -IMPORT FILE , How to add validation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-08, 14:19
Raj_db2 Raj_db2 is offline
Registered User
 
Join Date: Jan 2008
Posts: 3
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
Reply With Quote
  #2 (permalink)  
Old 01-24-08, 15:06
Raj_db2 Raj_db2 is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-24-08, 15:08
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #4 (permalink)  
Old 01-24-08, 15:10
Raj_db2 Raj_db2 is offline
Registered User
 
Join Date: Jan 2008
Posts: 3
Thanks Andy for the response .. This solution works I have tried out
Reply With Quote
  #5 (permalink)  
Old 01-30-10, 09:46
bulat bulat is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On