7

I am lazy, sometimes excruciatingly lazy but hey (ironically) this is how we get stuff done right?

Had a simple idea that may or not be out there. If it is I would like to know and if not perhaps I will make it.

When working with my MSSQL database sometimes I want to test the performance of various transactions over tables and view and procedures etc... Does anyone know if there is a way to fill a table up with x rows of junk data mearly to experiment with.

One could simple enough..

INSERT INTO `[TABLE]`
SELECT `COLUMNS` FROM [`SOURCE_TABLE`]

Or do some kind of...

DECLARE count int 
SET count = 0

WHILE count <= `x`
BEGIN
INSERT INTO `[TABLE]`
(...column list...)
VALUES
(...VALUES (could include the count here as a primary key))

SET count = count + 1
END

But it seems like there is or should already be something out there. Any ideas??

JBone
  • 3,163
  • 11
  • 36
  • 47
  • 3
    possible duplicate of [Tools for Generating Mock Data?](http://stackoverflow.com/questions/591892/tools-for-generating-mock-data) – Bill Karwin Aug 16 '11 at 20:03

4 Answers4

3

I use redgate SQL Data generator

Code Magician
  • 23,217
  • 7
  • 60
  • 77
  • 2
    I've used this as well. It's very nice, and can cover most situations if you're actually looking for halfway decent data, too. The problem of course is that $300 price tag. – Mike M. Aug 16 '11 at 20:24
  • $300 is cheap. You would spend much more than that in hours of development time to do the same thing. – HLGEM Aug 16 '11 at 21:29
  • 1
    @HLGEM, it is sad but true that many people work on a fixed salary for cheap companies that don't care how long you have to work to get the job done. you'd be more likely to get blood from a stone than get that software at some of the companies I've worked for in the past. – KM. Aug 17 '11 at 12:09
  • I upvoted this but declared the Data Generation Plan as the winner because it is built it. What do you all think about this decision? – JBone Aug 17 '11 at 15:13
2

Use a Data Generation Plan (a feature of Visual Studio database projects).

Josh Darnell
  • 11,304
  • 9
  • 38
  • 66
nvogel
  • 24,981
  • 1
  • 44
  • 82
1

WinSQL seems to have a data generator (which I did not test) and has a free version. But the Test data generation wizard seems to be reserved to the Pro version.

iDevlop
  • 24,841
  • 11
  • 90
  • 149
1

My personal favorite would be to generate a CSV file (using a 4.5 lines script) and load it into your SQL DB using BULK INSERT. This will also allow better customization of the data as sometimes is needed (e.g. when writing tests).

stnr
  • 435
  • 4
  • 14