DB2 Version 9.7 for Linux, UNIX, and Windows

Validating related objects

You can customize the SQL statements associated with a selected object. The Related Objects window in the Control Center allows you to identify SQL statements that need to be corrected before the specified table changes are actually applied.

Before you begin

To validate related objects when changing table columns, you must have DBADM authority.

About this task

Validation testing checks that all relationships for the selected object are valid, that the necessary user privileges are held, and that data transformations can occur without errors. If invalid statements are found, you can correct the statements.

Procedure

To validate objects:

  1. Open the Alter Table notebook: From the Control Center, expand the object tree until you find the Tables folder. Click the Tables folder. Any existing tables are displayed in the pane on the right side of the window. Right-click the table you want and select Alter from the pop-up menu. The Alter Table notebook opens.
  2. On the Columns page, perform one of the following actions to enable the Related objects button:
    • Rename a column
    • Drop a column
    • Change the data type of a column
    • Change the length, scope, or precision values for a column
    • Change whether a column is nullable
  3. Click Related objects. The Related Objects window opens.
  4. Click Test All to test the validity of the SQL statements for all of the objects listed in the Impacted objects table. The Validity column of the table is updated to indicate if each object is valid or invalid.
    • If no objects are invalid, then changes are not needed. Click Close to return to the Alter Table notebook.
    • If any of the objects is shown to be invalid, select the object in the in the Impacted objects table. The SQL statement for the object will appear in the SQL statement used for selected object field.
      • Use the error message box near the bottom of the window to identify the source of any errors for the selected object. Make any needed changes to the associated SQL statement. Click Apply to update the statement in the Impacted objects table.
      • Click Test SQL to check the validity of the corrected SQL statements for the selected object. In the Validity column of the Impacted objects table, the cell for the selected object is updated to indicate if the object is valid or invalid. If the object is valid, no further changes are needed. If the object is invalid, repeat the previous step to make further changes.

        Sometimes an SQL statement cannot be tested individually, as it might rely on other objects to be dropped or created. In this case, click Test All to test the validity of the SQL statements for all of the objects listed in the Impacted objects table.

  5. Once any necessary changes have been made and all objects in the Impacted objects table are valid, click Close to return to the Alter Table notebook.