Harbin Ramo
Harbin R

Harbin R

Test data loading in MS SQL

Harbin Ramo's photo
Harbin Ramo
·Dec 15, 2020·

2 min read

Sometimes, when I do stress testing of my app I would need massive data in order to test its performance. To perform a mass loading to your SQL database, you can run the script provided below.

Login MS SQL and go to File > New > Database Engine Query

Type in Use followed by the database name, then hit F5 to select the database of your choice.

USE <database name>;

Once the database has been selected, you can copy and paste the script below, then edit the following part(s) of the script: max value, table name, column(s) 1 to 4, finally value(s) 1 to 4.

SET @MinValue = 1;
SET @MaxValue = <maximum number of your choice>;
WHILE @MinValue <= @MaxValue
        INSERT INTO <table name>(column1, column2, column3, column4) 
        SELECT value1,value2,value3,value4
        SET @MinValue = @MinValue + 1

Hit F5 to begin loading data to your table.

After loading the data, you can check the result under Messages


Share this