Hi
I am getting data in flat file and reading the data and loading the data to DB2 databse. My requiremnt is insert new o rupdate the existing data in db2, but at the same time write the updating record data to a file.
Can some please give idea, how i can achive this?
How to insert data and capture duplicates
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India
-
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India
CRC32 is a function that generates a number based on its arugument. If the same argument comes in future, then same number will be generated.
For your case, Concatenate all your non key columns from source into a single value and pass this value to CRC32 function. Similarly calculate CRC value from lookup/target table also. If the Key column matches and CRC values doestnt match between source and lookup then it is an updated one.
This is not so efficient method. If anyone has easy and efficient way than this, it is appreciated.
For your case, Concatenate all your non key columns from source into a single value and pass this value to CRC32 function. Similarly calculate CRC value from lookup/target table also. If the Key column matches and CRC values doestnt match between source and lookup then it is an updated one.
This is not so efficient method. If anyone has easy and efficient way than this, it is appreciated.
I would place some kind of a delimiter after each column value during the concatenation of non-key values. This will eliminate incorrect interpretations caused by concatenation. For example, if there are only 2 non-key columns with values, then it will avoid situations caused by values such as-vinothkumar wrote:Concatenate all your non key columns from source into a single value and pass this value to CRC32 function. Similarly calculate CRC value from lookup/target table also. If the Key column matches and CRC values doestnt match between source and lookup then it is an updated one.
Code: Select all
1101 12
110 112
gateleys