Hi, this is Jeff Podlasek with Toad DB2 development. I going to demonstrate the new Test Data Generation feature we've added in Toad for DB2, version 5.0.
I've got Toad up and running, and I have connected to a DB2 LUW data base and I've got the data base explorer open on the Tables tab. And you have a list of several tables.
First thing I'm going to do in this demonstration is clone an existing table. So I'm going to right click and say Create the Like. That brings up the Table Creation dialog. And I'm going to give my new table a name of Test Eleven, and I'm going to keep the column definitions the same. So I'm going to execute this script. And it will create a new Test Eleven table and you can see it here. It's got the column definitions and it has no data.
So in order to populate data in it quickly, I'm going to right click on a table and say Generate Test Data. And that brings up the Data Generator wizard which will walk me through the steps to easily populate data in those columns.
This first screen allows me to select additional tables. And I'm going to keep this demonstration simple and only select the one table and use the one table. I can also add Dependent tables, or Reference tables. But we're going to keep this demonstration simple.
This next screen allows me to specify some options such as how many rows do I want to generate, whether or not I want to generate a Delete Statement at the top of the script that will ensure only my test data is inserted into the script, and it has some format options such as Date, Time, Time Stamp, formats as well as the decimal separator in the statement delimiter. I going to keep all of those the same and go Next.
Now this screen allows me to be more granular on how that data is generated. There's several different options such as Random Generate Sequence, Cost and Values, or No. For this bonus column I'm going to leave it as Random Generate. For this Commission column I'm going to say Randomly Generate but let's start at a value of 1000 and let's have a maximum value of 2000. For the Employee Number, which is a character data type, I'm going to keep that as Random Generate, the same with First, Last Name, Middle Initial.
For Salary, I'm going to say let's keep this as a sequence generate starting at 10,000 and ending at 20,000, and let's stop ten each time. And for the Work Department, I'm going to say let's keep this as a constant value with the values A, B, and C. You're going to click Next, and I'm going to send the script to the editor.
And you'll see that Toad generates this script that deletes from the existing table and then has all my inserts-- a hundred insert statements that I've generated. And you can see that the Work Department is a constant A, B, C, and you can see that the Salary column is stepping up ten each time.
So I'm going to run the script right now. The script is running. And the script is done. So now I'm going to go back to the table and hit Refresh, or F5. And all my data is displayed. So it's a very quick and easy way to generate test data. And this works for both DB2 LUW as well as DB2 on z/OS.