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 > [LOAD] UDB v.7 statement: correct?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-03, 13:39
stefanB stefanB is offline
Registered User
 
Join Date: Oct 2003
Posts: 18
Arrow [LOAD] UDB v.7 statement: correct?

Hi NG,

I'm currently working on a small business database and now it is time to populate it with some data. For this purpose I'll use the LOAD utility. Unfortunately, I will not have any DB2 access till next month, so there is no possibility for me to prove, if the statements are actually correct... It would be very cool, if you could take a look at this.

DEPTFILE has 4 elements:

EL1 positions 01 to 04
EL2 positions 05 to 20
EL3 positions 21 to 40
EL4 positions 41 to 44

DEPTTABLE has 4 columns

COL1 CHAR 4 NOT NULL
COL2 INTEGER
COL3 VARCHAR 16 NOT NULL
COL4 VARCHAR 20

COL1 = "department shortcut"
COL2 = "number of employees"
COL3 = "department title"
COL4 = "comment"

COL1 is primary key!

The following command sould delete all existing data from the table
und populate it with the input data.

db2 load data
from DEPTFILE
of asc
modified by striptblanks usedefaults
method L (1 4,5 20,21 40,41 44)
null indicators (0, 0, 21, 41)
replace into DEPTTABLE (COL1, COL3, COL4, COL2)

If there are only blanks between 41 and 45, the value in COL2 will be NULL (no employees in the department). Zero would do just fine, but it's only an example.
If there are only blanks between 21 and 40, the value in COL4 will be NULL.

I do appreciate everyones help!!!

Thanks in Advance,

S.B.

P.S. Sorry for my bad English...
Reply With Quote
  #2 (permalink)  
Old 11-05-03, 14:01
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: [LOAD] UDB v.7 statement: correct?

Quote:
Originally posted by stefanB
Unfortunately, I will not have any DB2 access till next month, so there is no possibility for me to prove, if the statements are actually correct...
You can download trial version of DB2 from the IBM web site

http://www14.software.ibm.com/webapp...c&cat=database

P.S. Your LOAD statement looks correct to me.
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