I'm developing an application that is using SQL Server for storage. For development/testing purposes I need a subset of production data that will be anonymised, converted into insert into table..
statements and checked into version control.
So far I've been doing
select top 100 *
into tempTableName
from TableName
then removing any personal data:
update tempTableName set
firstname = 'Joe',
Surname = 'Doe',
Email = 'joe@doe.com',
etc...
Then generating scripts with data and tick only tempTableName
.
That takes a fair chunk of time and error-prone – especially the bit where I remove personal data (think what would happen if I put wrong table name into the update).
Is there a better way to get sample data from production into scripts?
Best Answer
I've use the script in this post: Updating multiple rows with random values from another table https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f58c3bf8-e6b7-4cf5-9466-7027164afdc0/updating-multiple-rows-with-random-values-from-another-table?forum=sqlgetstarted
Generate the random data (another table) first: http://www.generatedata.com/