magritton
6/14/2015 - 1:21 PM

SQL code to create 5 million rows of test data in a small table

SQL code to create 5 million rows of test data in a small table

CREATE TABLE IOTest(ID INT IDENTITY 
                    CONSTRAINT [PK_IOTest_ID] PRIMARY KEY CLUSTERED (ID ASC)
                  , AnotherNumber INT
                  , AString CHAR(50)); 
GO
SET NOCOUNT ON;
INSERT INTO IOTest (AnotherNumber, AString)
       SELECT TOP (50000) ROW_NUMBER() OVER(ORDER BY a.OBJECT_ID), REPLICATE('A',50)
       FROM sys.columns AS a CROSS JOIN sys.columns AS b;
GO 100