开发者

Fill your tables with junk data?

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 jun开发者_JS百科k 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??


I use redgate SQL Data generator


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


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.


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜