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 > DB2 Primary Keys Masking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-20-09, 02:58
sudmm sudmm is offline
Registered User
 
Join Date: Apr 2009
Posts: 4
DB2 Primary Keys Masking

Hi,
We need to mask out the data in the primay key columns like 512345 should be masked to 500000 with out losing uniqueness. Can anyone please tell me a viable approach?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 04-20-09, 05:15
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
which db2 version you are using?
__________________
IBM Certified Database Associate, DB2 9 for LUW
Reply With Quote
  #3 (permalink)  
Old 04-20-09, 05:19
sudmm sudmm is offline
Registered User
 
Join Date: Apr 2009
Posts: 4
We are using DB2 9.0 on AIX
Reply With Quote
  #4 (permalink)  
Old 04-20-09, 11:31
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
the db2 platform/version will not solve the problem
what is the purpose of this and how did you try this ??
be as specific as possible to complete the scenario/messages....
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 04-20-09, 16:25
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
I am not sure how this should work. You ignore the last 5 digits (or set them to 0) and still want to get unique values? How would you handle 512345 and 598765?

Getting the result you mentioned can be done by:
Code:
SELECT(  col / 100000 ) * 100000
FROM ...
of course. (That's standard programming technique.)
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #6 (permalink)  
Old 04-20-09, 23:32
sudmm sudmm is offline
Registered User
 
Join Date: Apr 2009
Posts: 4
Yes, I still want to have uniqueness between the rows of a table. Can any one suggest the best alg. for this requirement.
Reply With Quote
  #7 (permalink)  
Old 04-21-09, 08:37
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Once you answer my question: how will could you guarantee uniqueness, i.e. what should happen with the values, we can tell you how to do that.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #8 (permalink)  
Old 04-21-09, 08:44
sudmm sudmm is offline
Registered User
 
Join Date: Apr 2009
Posts: 4
Hi Stolze,
I am in need of an alg./ method that will scramble the numbers in a key column with out affecting it's unique property. i.e. even after scrambling, I should able to find that row uniquely using the new scrambled value in that key column.

Could you please suggest me something of this sort?
Reply With Quote
  #9 (permalink)  
Old 04-21-09, 14:09
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
What do you mean with "scramble"?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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