Editing a primary key
Use the following procedure to add or delete columns in an existing primary key. You can also drop a primary key from a table that existed before the subsystem was upgraded with the IBM CATMAINT utility. (A UCP object type will not be displayed in the Mixed List for this type of table.)
To edit a primary key
- On the BMC AMI Change Manager for Db2 Main Menu, select WORKID, and press Enter.
- On the WORKID Action Menu, type the name of the existing WORKID or type a wildcard pattern to display a list of work IDs. Then, select Specify Db2 definitions and press Enter.
- On the Object Specification panel, specify the name of a database, table space, and table (or use wildcard characters). Then, press Enter.
On the Mixed List panel, type PK in the Act column adjacent to the table (TB) that you want to modify. A primary key is created if one does not exist.The Constraint Key Mixed List panel is displayed.
ALUSUC2 ER -------------------- Constraint Key Mixed list -------------------
Command ===> Scroll. . PAGE
WORKID . . . . : RDACRJ.UC01 Commands: CANCEL
Table . . . : RDACRJ.TB_N2A
Const Name . : TN2A_TS_1
(C)opy column from the Table, indicate position in Key Columns
using (A)fter/(B)efore, and press ENTER.
Lines 1 to 7 of 19
More: +
Act Colname Column Type UDT Length Nl FP
************************************ TOP **************************************
A CONSTRAINT KEY .:
1 TN2A_TS_1
D 2 TN2A_C4_1
PARENT TABLE . .: RDACRJ TB_N2A
C C1 CHAR 3 N N
TN2A_C4_1 CHAR 4 N N
TN2A_C4_2 CHAR 4 N N
TN2A_C6_3 CHAR 6 N N
TN2A_C4_4 CHAR 4 N NSpecify the modifications to the columns in the constraint.
Modification
Action
To add a column
Type C in the Act column adjacent to the column name or names that you want to use. Then, type A in the Act column adjacent to the Constraint Key.
To delete a column
Type D in the Act column adjacent to the column name below the Constraint Key.
Press Enter.The Constraint Key Mixed List panel is displayed as shown in the following figure. The column added for the constraint is displayed below the constraint key.
ALUSUC2 ER -------------------- Constraint Key Mixed list -------------------
Command ===> Scroll. . PAGE
WORKID . . . . : RDACRJ.UC01 Commands: CANCEL
Table . . . : RDACRJ.TB_N2A
Const Name . : TN2A_TS_1
(C)opy column from the Table, indicate position in Key Columns
using (A)fter/(B)efore, and press ENTER.
Lines 1 to 7 of 20
More: +
Act Colname Column Type UDT Length Nl FP
************************************ TOP **************************************
CONSTRAINT KEY .:
L 1 C1
2 TN2A_TS_1
D TN2A_C4_1
PARENT TABLE . .: RDACRJ TB_N2A
C1 CHAR 3 N N
TN2A_C4_1 CHAR 4 N N
TN2A_C4_2 CHAR 4 N N
TN2A_C6_3 CHAR 6 N N- Press END until the WORKID Action Menu is displayed.
- Update the associated index columns.
Update the associated foreign key columns of the child table.
Now that the primary key has been modified, you can analyze the work ID and execute the worklist.