Friday, April 18, 2014

Randomizing Data

Ideally, development and testing data is reasonably robust to allow for realistic testing. Occasionally though, pulling in a copy of the production database is useful to hunt down specific cases. Personal information should be scrubbed from this though.

http://www.generatedata.com/ is a great tool for generating large amounts of random data. It's easy to install a local copy too. Data sets can be saved and re-used. Large amounts of seed data for testing can also be created.

To replace existing columns with random data, its fairly straight forward to create an SQL script to do this.



The general script runs as follows:

  1. Create a temp table to store our random data for the duration of the transaction
  2. Insert random data, generated from www.generatedata.com. This will need to be massaged a bit if going to MsSql.
  3. Update appropriate tables and fields using CROSS APPLY
  4. Woot! Data scrubbed!

No comments:

Post a Comment