HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

A Script to insert dummy Data in all tables of Database

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
scriptdummytablesinsertalldatabasedata

Problem

I wanted a Script that can loop through all tables and their columns in the database and insert dummy data based on column type and size, so that i can start using the database for testing, and ability to run queries and Test Apps.

Solution

There are lots of cases that @AmmarR's solution doesn't handle - ROWVERSION/TIMESTAMP, computed columns, columns with check constraints, foreign keys, UNIQUEIDENTIFIER columns that default to NEWSEQUENTIALID(), date/time columns that default to GETDATE(), sparse columns, etc. etc.

Why reinvent the wheel? There are tools out there that can generate data for you and they've probably already thought about all of these restrictions. For example DTM Data Generator (not free, have not tested it) and Red-Gate SQL Data Generator (not free, have tested it and recommend it - also reviewed here).

Context

StackExchange Database Administrators Q#19938, answer score: 9

Revisions (0)

No revisions yet.