[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

DB2 SQL statemnet in AIX to update the confidential data to TST1, TST2, ... TSTn which n can be row number

I need a AIX db2 sql statement to change all the data of customer column/field to TST1, TST2, ... TSTn which n can be row number to prevent duplicate data. Many thanks.
0
martinlau
Asked:
martinlau
  • 2
  • 2
1 Solution
 
PortletPaulCommented:
would you like to provide:

the table name?
the field name?
is there any order you want imposed on the integer? (what fields are used for that order?)
is there an existing integer we could use for this? what is it's name?

& anything else you think you might have missed in the very brief question
0
 
momi_sabagCommented:
try something like this

update my_table t1
set t1.customer_column = (select rown
                                              from (select row_number() over(order by customer_id) as rown, customer_id
                                                         from my_table) t2
                                               where customer_id = t1.customer_id)
0
 
martinlauAuthor Commented:
Thanks a lot for your response. I found out that my question is mislead and not correct and would like to revise as follows:

For example, I have 2 tables customer1, customer2 and both of them have customerid, customer name,phone data field, now I would like to change the customer name of both tables to mask the confidential information by changing the customer name to test1, test2 which test is the masking fixed string and n is any unique number. This moment, as I could not confirm the rows of two tables is exact same, I also need to ensure the matching between them. For example, customerid 12345 with new customer name test999 in table customer1 and we should also have customerid 12345 record with customer name test999 in table customer2. please do me a flavor to provide further advice accordingly? Thx.
0
 
PortletPaulCommented:
At the very least you should provide the table definitions - you really are making this hard - for you as well as us.

Without simple facts like table names and fields names we will "invent" some, you will then need to "translate" those - and not make mistakes in the translation.

Believe me, it is easier for everyone involved if you tell us the table names and the fields names.
0
 
martinlauAuthor Commented:
Thanks for all experts which had given their advice to me before.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now