Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Scramble/Mixup SQL Records

Posted on 2009-07-06
6
Medium Priority
?
521 Views
Last Modified: 2013-11-15
Hi all,

I have been asked by the developers of our internal database program for a backup of our SQL database because they "lost" their copy of it. My bosses agreed to give them a copy of it but they worry what their true intentions are. I tried to get them to accept a small portion of it but they say they want the full copy to do stress testing, or so they claim. If we give them a shorter version, we worry that the service they provide will decline further in quality.

Any ideas as to how I can go about scrambling or mixing up the data? I realize this is a broad question since you don't know what my database looks like. There are too many tables to list and the relationships between tables are numerous. I would just like to hear people's thoughts on this, maybe there is an easy way I'm missing.

I can post some exmaple of the tables I would like to scramble if necessary.

Thanks,
Primus
0
Comment
Question by:PrimusPilus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Emes
ID: 24787897
What I have done in the past is make there copy of the database. That will be use by the Dev team.

Then run some sql that will change important data fields like salary.

using the RAND() funciton.

then backup that data and give it to them



0
 
LVL 5

Assisted Solution

by:rgc6789
rgc6789 earned 800 total points
ID: 24788101
Also make sure you "scramble" any contact info such as phone numbers, emails, etc. I dealt with a problem in the past where someone contacted all the clients via email.
0
 

Author Comment

by:PrimusPilus
ID: 24788481
Hi guys,

Thanks for your input!

I'm not sure if Rand will do what I need?  Below is an example (short example) of what I would like to change:
 
PeopleID            FirstName              LastName          Phone1                        Phone2                       Phone3

090909                Primus                     Pilus           416-555-5555              416-555-3333               416-555-4522
080808                 Gaius                     Marius         416-555-6666              416-555-4444               416-555-2332
070707                 Pompey                  Great          416-555-3333              416-555-2322               416-555-3421

So what I would like to do is have the entries in Phone1, Phone2, Phone3 mix matched so that Marius's numbers are now Pompey's numbers. I would also like to change the names around so that the names no longer match the PeopleID. This is because the database has a lot of tables that use the PeopleID as the key. Changing this around basically makes all the other data useless!

Am I able to use RAND to generate random phone numbers?

Thanks,
Primus
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 14

Accepted Solution

by:
Emes earned 1200 total points
ID: 24788698
For the phone numbers just take the middle 3 digits and make it 555 like your sample
you could use the rand to do it too.

select
convert(varchar(3),convert(int,rand()*1000))
+'-'+ convert(varchar(4),convert(int,rand()*10000)

0
 
LVL 14

Expert Comment

by:Emes
ID: 24788739
here is a better code

Will take care of 2 digit numbers

select
convert(char(1),convert(int,rand()*8)+2)+
convert(char(1),convert(int,rand()*10))+
convert(char(1),convert(int,rand()*10))+
  '-' +
convert(char(1),convert(int,rand()*10))+
convert(char(1),convert(int,rand()*10))+
convert(char(1),convert(int,rand()*10))+
convert(char(1),convert(int,rand()*10))

You can do the same if you need an area code
0
 

Author Closing Comment

by:PrimusPilus
ID: 31600289
Thanks guys,

I ended up using RAND() and got most of the numbers randomly generated. The rest I simply duplicated!

Primus
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question