Updating Records in Table
Moderators: chulett, rschirm, roy
Updating Records in Table
Hi
I am having my job as follows:
I/P -->TX(lookup + constraint in TX for INSERT AND UPDATE)-->(NEWKEY GENEARTION(for insert new rows) --> Target table
I am adding a flag in TX SAYING THAT IT IS NEW OR NOT (using "Y" for NEW and "Y" for OLD). Initially I gave "Y" for flag and inserted all records in target table.
My question is if Flag = "N", then it is an old record and needs to be updated. How to accomplish this?
I am having my job as follows:
I/P -->TX(lookup + constraint in TX for INSERT AND UPDATE)-->(NEWKEY GENEARTION(for insert new rows) --> Target table
I am adding a flag in TX SAYING THAT IT IS NEW OR NOT (using "Y" for NEW and "Y" for OLD). Initially I gave "Y" for flag and inserted all records in target table.
My question is if Flag = "N", then it is an old record and needs to be updated. How to accomplish this?
Pradeep Kumar
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Updating Records in Table
pradkumar wrote: I am having my job as follows:
I/P -->TX(lookup + constraint in TX for INSERT AND UPDATE)-->(NEWKEY GENEARTION(for insert new rows) --> Target table
My question is if Flag = "N", then it is an old record and needs to be updated. How to accomplish this?
Looks/sounds good - but I do have one question - how are you determining your flag?pradkumar wrote: Right now I am having only two links and
I am giving the rule
for Insert as : Insert new rows only
for UPDATE AS: Update existing rows only
Is this correct
I only ask as the above assumes that you have the key to update an existing record.pradkumar wrote:For First Insertion I am assigining the Flag to "Y"..(NEW)
If user changes the current_ind in target table to "N"
my job should be update only that record with flag set to "N"
I just thought i would check that this is the case, as you mentioned that the key is generated on insert. So long as you have the key then you should have no problems.
-
- Participant
- Posts: 232
- Joined: Fri Sep 30, 2005 4:52 am
- Contact:
You have done correctly by taking 2 links.pradkumar wrote:Right now I am having only two links and
I am giving the rule
for Insert as : Insert new rows only
for UPDATE AS: Update existing rows only
make flag column also as key column in datastage.
keep in insert link Flag = 'Y' and Update link Flag = 'N'
Thanks,
Anupam
Yes I got this bit the first time.pradkumar wrote:For First Insertion I am assigining the Flag to "Y"..(NEW)
If user changes the current_ind in target table to "N"
my job should be update only that record with flag set to "N"
To update your target table though you will need the key for the row to update. If you are looking for a flag of 'N' in the target table how are you firstly identifying the row to look for? Is the key of the target table available in your input?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
What are the constraint expressions for the two links in your Transformer stage? What is the derivation expression for your flag (the actual expression, not what it does)? What, precisely, is the problem that you are trying to solve?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: