How to: Specify Columns for Data Generation

To generate data, you must create and run a data generation plan. The data generation plan contains the information about which tables and columns you want to fill with data. For more information, see Generating Test Data for Databases by Using Data Generators.

The following are important things to consider when you specify columns for data generation:

  • You must generate data for primary key columns.

  • You must generate data for columns that are not nullable, except columns that have a default constraint.

  • You can partially fill a nullable column. To test NULL values, you do not have to leave a whole column null. Include the column in data generation, and then set the Percentage Null property for the column.

Before you can specify the columns that you want to fill with data, you must open or create a data generation plan, and specify the tables that you want to fill with data. For more information, see How to: Create Data Generation Plans and How to: Specify Tables for Data Generation.

To select columns to fill with data

  1. Open or create a data generation plan. The data generation plan and the Data Generation Preview window appear in Visual Studio.

    Note

    If the Data Generation Preview window is not open, you can open it by opening the Data menu, pointing to Data Generation, and then clicking the window name. By default, the Data Generation Preview window is docked and tabbed at the bottom of the data generation plan window. To expand your view, click the window and then click Tabbed Document on the Window menu. You can also right-click in the title bar and then click Tabbed Document.

  2. Click the data generation plan window.

    The data generation plan window is divided horizontally into two areas. The upper area lists all the tables in the schema. The lower area displays column details for a highlighted table.

  3. Click a table for which you want to specify columns to fill.

  4. Click in the column-details pane.

    All the columns in the table are listed.

  5. Select and clear the check boxes in front of each column to specify the columns that you want to fill with data. You will not be able to clear the check boxes for columns that are primary keys or that are not nullable and do not have default constraints.

    Note

    The Properties window displays the Allow Nulls and Default Value properties. You can use these properties to decide which columns to fill with data.

  6. (Optional) Repeat steps 3 through 5 for each table included in the data generation plan.

  7. On the File menu, click Save.

    Now that you have specified what columns you want to include, you can specify how you want to fill the columns with data. For more information, see Specify Details of Data Generation for a Column.

See Also

Tasks

How to: Specify the Number of Rows to Generate

How to: Run a Data Generation Plan to Generate Data

Walkthrough: Creating and Running a Data Generation Plan