Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Something like oracle's SQL-Loader? 2

Status
Not open for further replies.

ddiamond

Programmer
Apr 22, 2005
918
US
I'm an oracle user who is attempting to switch to db2. Is there anything for db2 similar to oracle's sql-loader that allows you to bulk load a flat-file into db2 from the command line? If so, how should the flat-file be formatted? In oracle, you define the format of the flat-file in a ctl file. How does db2 handle it?
 
The options are "import" or "load". Load is much faster. It doesn't have quite the same level of functionality as SQL*Loader but can do fixed format or comma delimited files.
 
For fixed width files, I've seen examples where the field positions are listed directly on the load command line. Is it possible to put the field positions in a seperate file instead for ease of maintenance?
 
No, there is no equivalent of the SQL*Loader control file. The nearest you could get would be put the positions in a file, read it in using a shell script and dynamically construct the load command.
 
ddiamond,

if it's an ASC file your loading then there is an option on both the load and import commands you can use to specify field positions, though as dagon says it's not in a seperate file.

If you wish to specify where the fields positions are in the file on the load or import command use Method L and specify column start and end positions.

Try the following link for an example


Cheers
Greg
 
Thanks for your help, guys. Dagon, I like your idea of using a shell script to dynamically create the load command. If I choose to stick with asc files, that is the approach I will take. I'm also exploring the option of switching to del files. That way I wouldn't have to worry about field positions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top