Posts

Showing posts with the label Test Data

SQL - Test Data - Quick and Easy

Image
O ften I find myself needing large amounts of test data in SQL, either for performance testing or simply to have something to work with on the UI.  Fortunately this little SQL gem does the trick, and quickly too! The following query will insert several hundred records (673 in Northwind, though this will depend on the database) in less than a second. insert into [Northwind] . [dbo] . [Employees]            ( [LastName]            , [FirstName] )      select            substring ( cast ( newid () as varchar ( 36 )), 0 , 20 )            , substring ( cast ( newid () as varchar ( 36 )), 0 , 10 )            from sys . columns T1 Need more records?  Try cross joining.  This...