Here’s a quick trick my friend Jonas showed me for quickly inserting test data for testing stuff like pagination:
INSERT INTO [ChildTable] ([Foo] ,[LastUpdateDateTime] ,[CreateDateTime] ,[InsertUser] ,[UpdateUser]) select [Foo] ,[LastUpdateDateTime] ,[CreateDateTime] ,[InsertUser] ,[UpdateUser] from [ChildTable] GO
This script basically selects the contents of the table, and then inserts those contents on top of it’s self, thereby doubling the number of rows every time you run it.
If you need to link these to another table via a foreign key, you can link them up as follows:
INSERT INTO [ParentTable] ([Bar] ,[FooId]) SELECT draft.[Bar] ,can.Id FROM ParentTable draft cross join ChildTable can
This does the same trick, only by doing a cross reference it generates every permutation of row from the first table (Foo), and inserts it into the new table (Bar).