In my earlier article, I’ve explained how to install/restore the SQL Server 2016 sample database Wide World Importers. This sample database comes with some pre-generated data in it. But it may be few months older. You may also more transaction data for training purpose then wat is available in sample database by default. In this article I’ll explain the process of generating more data In WideWorldImporters database.
The Wide World Importers database comes with a stored procedure DataLoadSimulation.PopulateDataToCurrentDate to populate the transaction tables till the current data and with more data. You just need to use this stored procedure for generating more and recent data in Wide World Importers sample database.
Steps For Generating More And Recent Data
- Login to Management Studio (SSMS).
- Open a new query editor window for database WideWorldImporters.
- Run the below Query in the query editor window.
EXECUTE DataLoadSimulation.PopulateDataToCurrentDate @AverageNumberOfCustomerOrdersPerDay = 25, @SaturdayPercentageOfNormalWorkDay = 40, @SundayPercentageOfNormalWorkDay = 20, @IsSilentMode = 1, @AreDatesPrinted = 1;
You can change the amount of data generated by changing the value of the parameters:
- @AverageNumberOfCustomerOrdersPerDay: This is the number of orders by the customer per day during the working days from Monday to Friday. In the above query I’ve specified 25 orders per day. You can increase or decrease the value.
- @SaturdayPercentageOfNormalWorkDay: This is the percentage of orders on Saturday compared to the normal working days. You can change this value from 0 to 100.
- @SundayPercentageOfNormalWorkDay: This is the percentage of orders on Sunday compared to the normal working days. You can change this value from 0 to 100.
- NOTE: This query will take several minutes to generate the data based on the number of days till the current date and your computer’s speed. For me the above query took more than 35 minutes to generate data from Jun 01, 2016 to Oct 15, 2016 on my Windows 10 virtual machine.
- About WidwWorldImporters data generation @ MSDN.