Q
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Import a text file to a DB2 table

One user writes, "I need to "import" a text file located in the user computer to a DB2 table in the database, what's the best way to do this?" DB2 expert Kent Milligan offers some advice.

I need to "import" a text file located in the user computer, to a DB2 table in the database, what's the best way to do this?

You have a couple of options: 
You could create a table with a CLOB column, store the text file in that column, and use LOB Locators to access the data. For more information on this technique, consult the Redbook "DB2 UDB for AS/400 Object Relational Support." 

Another option would be to copy the text file to a stream file on the IFS and use the CPYFRMIMPF command. Example: CPYFRMIMPF FROMSTMF('/testdir/fromfile.txt') TOFILE(QGPL/TOFILE) MBROPT(*REPLACE) RCDDLM(*ALL) STRDLM(*NONE)

More on this topic

Visit the ITKnowledge Exchange and get answers to your DB2 questions fast.

Check out this Search400.com Featured Topic: Expert advice on DB2 

Search400.com's targeted search engine: Get relevant information on DB2/400. 

The Best Web Links: Tips, tutorials and more.

 

This was last published in August 2005

Dig Deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close