How to: Define a Data Generation Plan that Reuses Data from Another Database

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio 2010 Professional 

Visual Studio Express

Topic applies Topic applies Topic does not apply Topic does not apply

To generate data, you must create and run a data generation plan. You can define a data generation plan that extracts data from another database. The data generation plan contains the information about which tables and columns that you want to fill with data. It also contains details about what kind of data that you want to put in each column, and how much. The data generation plan is saved as a file in the database project that you can edit and reuse. For more information, see Generating Test Data for Databases by Using Data Generators.

To define a data generation plan that reuses data

  1. Open or create a database project or data-tier application component (DAC) project.

    Note

    If you create a data generation plan in a project that does not have a schema yet, the plan will be empty. If you import a schema into the project after you have created the plan, you are prompted to decide whether to update the plan based on the new schema.

  2. Right-click the Data Generation Plans node in Solution Explorer, point to Add, and then click Data Generation Plan.

    You can also click a folder in Solution Explorer, open the Project menu, and click Add New Item.

  3. In the Installed Templates pane, click Data Generation Plan.

  4. In the details pane, click Data Transform Plan.

  5. In the Name box, type the name that you want to give the data generation plan.

  6. Click Add.

    The Data Transform Plan dialog box appears.

  7. In Source connection string, click the connection that corresponds to the database from which you want to reuse data. If the connection does not exist, you can create it by clicking New Connection. For more information, see How to: Create a Database Connection.

  8. You can optionally customize the plan generation options. For more information, see the following procedure.

  9. Click OK.

    The Data Transform Plan Status dialog box appears and the data generation plan is created.

  10. Click Close.

    Your data generation plan opens. You might want customize the plan if the database that you are reusing contains tables or columns with sensitive information. For more information, see Specify Details of Data Generation for a Column.

To customize options for the Data Transform Plan

  1. If you want each table to have the default number of rows as specified in Tools, Options, clear the Set the number of rows to generate to be equal to the number of rows in the source database check box.

  2. If you want the foreign key generator to generate foreign keys instead of copying them from the source database, clear the Replace foreign key generator check box.

  3. If you want to replace the foreign key generator and all foreign keys were generated by your application and not by the database, select the Replace foreign key generator check box and select the Replace all foreign key generators with foreign keys from the target database radio button.

  4. If you want to replace only foreign keys that do not reference a value that was generated by the database, select the Replace foreign key generator check box and select the Use foreign keys from the source database when the foreign key does not reference a column with database-generated values radio button.

  5. If you want to allow some number of tables to fail data generation before you stop the data generation process, enter a nonzero value in Error thresholds.

See Also

Tasks

Walkthrough: Creating and Running a Data Generation Plan

Concepts

Specify Details of Data Generation for a Column

Generating Test Data for Databases by Using Data Generators