View previous topic :: View next topic |
Author |
Message |
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Mon Feb 26, 2007 10:02 am Post subject: LOAD problem |
|
|
Hi,
I am facing a typical problem in LOAD this time.
I have table having three fields.What I need to do is load the first two columns of the table and while I do so.I need to insert XYZ in the third column.suppose If i load 2 million records in the first two columns there should be 2 million XYZ in the third.How to do that?
Regds,
Kingo _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Mon Feb 26, 2007 11:58 am Post subject: |
|
|
kingo,
you have couple of options
1.Define the col3 with default value of 'xyz' in your Create table statement.
Code: |
CREATE TABLE your_tbl
(COL1 CHAR(10) NOT NULL WITH DEFAULT
,COL2 CHAR(5) NOT NULL WITH DEFAULT
,COL3 CHAR(3) NOT NULL WITH DEFAULT 'XYZ')
;
|
so whenever you are inserting a new row if you don't provide a value for col3 it will be populated by xyz.
2. Create the load dataset to 'XYZ' in the col3 position.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Mon Feb 26, 2007 11:13 pm Post subject: |
|
|
Kolusu can you please explain the second option please.
Regds,
Kingo _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
programmer1 Beginner
Joined: 18 Feb 2004 Posts: 138 Topics: 14
|
Posted: Tue Feb 27, 2007 12:14 am Post subject: |
|
|
Create a dataset with the required data and append 'XYZ' to every record of your load dataset _________________ Regards,
Programmer |
|
Back to top |
|
|
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Tue Feb 27, 2007 12:21 am Post subject: |
|
|
Thanks programmer1
Regds,
Kingo _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Tue Feb 27, 2007 12:28 am Post subject: |
|
|
Is there anyway to LOAD data when i declare the third column with not null alone?
Regds,
Kingo _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
programmer1 Beginner
Joined: 18 Feb 2004 Posts: 138 Topics: 14
|
Posted: Tue Feb 27, 2007 12:31 am Post subject: |
|
|
What exactly is your requirement ? I can't understand you. _________________ Regards,
Programmer |
|
Back to top |
|
|
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Tue Feb 27, 2007 12:41 am Post subject: |
|
|
Actually i have a table with three columns.Need to load first two fileds and when i do so i
need to insert XYZ in third field.I didnt create with not null with default 'XYZ'.So I need any other way to populate the value.
Regds,
Kingo _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Feb 27, 2007 6:58 am Post subject: |
|
|
Write a program that reads each record and writes it out with 'XYZ' appended to it. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Tue Feb 27, 2007 10:54 pm Post subject: |
|
|
Thanks
Regds,
Kingo _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Wed Feb 28, 2007 4:55 am Post subject: |
|
|
Why not drop the table and recreate it with the default defined? Quick and easy and one less program to maintain! _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
|
|