Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fill your tables with junk data?

Tags:

sql

sql-server

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??

like image 967
JBone Avatar asked Aug 16 '11 20:08

JBone


People also ask

How do I fill a table with data in SQL?

Use INSERT to insert rows into a table. You can either specify every column value in parentheses after the VALUES keyword, or you can specify a comma-separated list of columns name before VALUES , and only specify those column values in the parentheses after.


3 Answers

I use redgate SQL Data generator

like image 114
Code Magician Avatar answered Sep 25 '22 04:09

Code Magician


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

like image 43
nvogel Avatar answered Sep 22 '22 04:09

nvogel


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.

like image 21
iDevlop Avatar answered Sep 23 '22 04:09

iDevlop