How to view and edit table and column comments with IBM Data Studio

Introduction

This tutorial will show you how to edit the descriptions of tables and columns in DB2 using IBM Data Studio.

There are three options in IBM Data Studio called Activities from which you can view the code.

  1. Administer Databases
  2. Develop SQL and Routines
  3. Tune Queries

All these options can be selected from the Activity option menu buttons.

Editing table descriptions

IBM Data Studio has some options for editing the description of tables in a DB2 database, as described next.

Option 1 – Using the Administer Databases activity option

  1. In the left pane of the screen that is displayed, expand the All Databases node and select the appropriate database to expand its objects tree, then select Tables.
  2. In the upper right pane, right-click on the desired table and select Alter in the context menu.

  1. In the lower right pane, select the Documentation option and start writing or editing the table description.
  2. Click on the button Save Changes when done.

After saving any changes, you need to generate a DDL to deploy the changes. You can do this using any of the following two options:

  1. If the change plan is active and displayed in the change plan toolbar (you are viewing the previous screen), click on the Generate DDL button located in the upper pane.

  1. If the change plan is not active (you are viewing a different screen than the previous one), in the Administration Explorer, click the Change Plans folder in the database. From the Object List, right-click on the change plan to deploy and select the Review and Deploy option.

Now you will see a progress screen and then you will get the review and deploy screen, where you can review the commands that will be executed. Select the option Deploy the change commands and click on the Finish button.

Option 2 – Using the Develop SQL and Routines or the Tune Queries activity option

  1. In the left pane of the screen that is displayed, select the Data Source Explorer tab and expand the Database Connections node.
  2. Select the appropriate database to expand its objects tree.
  3. Expand the Schemas node and the schema name where the table is located.
  4. Expand the Tables node and right click on the desired table.
  5. Choose the Alter option in the context menu.

  1. In the lower right pane, select the Documentation option and start writing or editing the table description.
  2. Click on the Save Changes button when done.

After saving any changes, you need to generate a DDL to deploy the changes, as described in option 1.

Option 3 – Using the pictorial path

  1. In the upper right pane, click on the last icon of the pictorial path to display the list of options, then select Tables.

  1. Again, in the upper right pane, right-click on the desired table and select Alter in the context menu.

  1. In the lower right pane, select the Documentation option and start writing or editing the table description.
  2. Click the button Save Changes when done.

After saving any changes, you need to generate a DDL to deploy the changes, as described in option 1.

Editing column descriptions

IBM Data Studio also provides some options for editing the description of columns in a DB2 database, as described next.

Option 1 – Using the Administer Databases activity option

  1. In the left pane of the screen that is displayed, expand the All Databases node and select the appropriate database to expand its objects tree, then select Tables.
  2. In the upper right pane, right-click the desired table and select Alter in the context menu.

  1. Again, in the upper pane, double-click the table name to show its list of columns, then select a column.
  2. In the lower pane select the Documentation option and start writing or editing the column description.
  3. Click the button Save Changes when done.

After saving any changes, you need to generate a DDL to deploy the changes, as described in option 1 of the section Editing table descriptions.

Option 2 – Using the Develop SQL and Routines or the Tune Queries activity option

  1. In the left pane of the screen that is displayed, select the Data Source Explorer tab and expand the Database Connections node.
  2. Select the appropriate database to expand its objects tree.
  3. Expand the Schemas node and select the schema name where the table is.
  4. Expand the Tables node and expand the desired table node.
  5. Expand the Columns node and select a column.
  6. In the lower right pane, select the Documentation option.
  7. Click the Edit button and start writing or editing the column description.

  1. Click the button Save Changes when done.

After saving any changes, you need to generate a DDL to deploy the changes, as described in option 1 of the section Editing table descriptions.

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.