Toad World® Forums

Test data generating

I am using Toad Data Point 3.8.

Is there a way to generate test data with this program?

Yes. In a #temp table, local storage (pro edition needed), real table (even if you will delete it when done), table variable, etc.? What are you trying to do? What platform are you on (Oracle, Sql Server, MySql, etc.)? More info you give, the more help you can get. You have lots of users that come here and Dell has Toad experts looking though these.

Thanks for the reply. For creating the test data, I am using SQL 2008 R2. And I’m trying to create some test data in a test table, such as: FirstName, LastName, CompanyCode, Gender.

You can use SQL to create the table and generate the table either by creating the table then populate the data or created the table by populating the data. The latter method will default the data types for you (as in if company code is all numbers you will get an Int datatype where you might have wanted a varchar field).

Populate and create in one step:

Select T.*

Into YourTableName

From

(select ‘John’ FirstName, ‘Smith’ LastName, 101 CompanyCode, ‘M’ Gender

union all

select ‘James’, ‘Landry’, 101, ‘M’

union all

select ‘Julie’, ‘Jones’, 101, ‘F’

union all

select ‘Eric’, ‘Boss’, 102, ‘M’

union all

select ‘Nigel’, ‘Johnson’, 101, ‘M’

) T

To have exact control of the datatypes create the table first and then use Insert Into YourTableName followed by the subquery part of the above sql. The field order must match the table field order and include all fields unless you specify the table fields to be populated in which case you must follow the order that you specified.

Great script.

Thanks!!