Scenario


After the successful registration of customers, company decides to create an application to send automatic updates of a product to registered customer. The application developer uses column name as CUSTOMER_TYPE instead of TYPE in the SQL statements. Because of the mismatch in column name in the database table and the application, application will not run.


Problem


As the occurrences of CUSTOMER_TYPE column in the application is high the DBA has to rename the customer table column TYPE column to CUSTOMER_TYPE to get the application working.


Solution


To solve the above problem, DB2 9.7 offers RENAME COLUMN option in the ALTER TABLE command. DBA performs below steps to accommodate this requirement.

  1. Rename column using RENAME COLUMN option in ALTER TABLE command.

  2. Check the new definition of table from syscat.columns.

  3. Fetch the rows from customer table using SELECT command.


Output


After running the SQL scripts on the right pane,
Result tab 2 of 3shows a column TYPE renamed to CUSTOMER_TYPE in the base table CUSTOMER.