Limited support BMC provides limited support for this version of the product. As a result, BMC no longer accepts comments in this space. If you encounter problems with the product version or the space, contact BMC Support.BMC recommends upgrading to the latest version of the product. To see documentation for that version, see ALTER and BMC AMI Change Manager for Db2 13.1.

Creating a unique constraint for a table


You can create a new unique (nonprimary) constraint for a table. A table might already have a primary key and none, one, or more unique (nonprimary) constraints.

  1. On the BMC AMI Change Manager for Db2 Main Menu, select WORKID, and press Enter.
  2. 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.
  3. On the Object Specification panel, specify the name of a database, table space, and table (or use wildcard characters). Then, press Enter.
  4. On the Mixed List panel, type CUC in the Act column adjacent to the table (TB) for which you want to create a unique (nonprimary) constraint.
  5. On the Create Constraint panel, specify the information about the constraint.
    1. (Optional) Type the name of the constraint.

      Tip

      Some object names might be too long to be displayed on a panel. To edit a long object name, position the cursor on the object name and press the ZOOM (F4) key.

    2. Type U for the Constraint Type to create a unique constraint.
    3. To specify the columns in the constraint, type S to select Constraint Key Columns.
    4. Press Enter.The Constraint Key Mixed List panel is displayed.

      ALUSUC2 ER   -------------------- Constraint Key Mixed list -------------------
      Command ===>                                                    Scroll. . PAGE

      WORKID  . . . . : RDACRJ.UC01                                 Commands: CANCEL

      Table  . . . : DEMOCJ.T0110_REFERRAL
      Const Name . : UKEY2

      (C)opy column from the Table, indicate position in Key Columns
      using (A)fter/(B)efore, and press ENTER.
                                                                 Lines 1 to 7 of 15
                                                                       More:     +
      Act         Colname                          Column Type      UDT Length Nl FP
      ************************************ TOP **************************************
      A   CONSTRAINT KEY .:
          PARENT TABLE . .: DEMOCJ     T0110_REFERRAL                               
      C           REFERRAL_NUM                     DECIMAL                 10   N  N  
                  AREA_NUM                         SMALLINT                     N  N  
                  CASE_NUM                         DECIMAL                 10   N  N  
                  CREATION_DT                      DATE                         N  N  
                  DISCOVERY_DT                     DATE                         N  N  
                  MAX_HIST_SEQ_NUM                 SMALLINT                     N  N  
                  CASE_POOL_NUM                    SMALLINT                     N  N
  6. Specify the columns in the constraint.

    Tip

    Some object names might be too long to be displayed on a panel. To view a long object name, position the cursor on the object name and press the ZOOM (F4) key.

    1. Type C in the Act column adjacent to the column name that you want to use.

      Note

      To select more than one name, type CC in the Act column adjacent to the first column name and CC in the Act column adjacent to the last column name.

    2. Type A in the Act column adjacent to the Constraint Key.
    3. Press Enter.The Constraint Key Mixed List panel is displayed as shown in the following figure. The column specified for the constraint is displayed below the constraint key.

      ALUSUC2 ER   -------------------- Constraint Key Mixed list -------------------
      Command ===>                                                    Scroll. . PAGE

      WORKID  . . . . : RDACRJ.UC01                                 Commands: CANCEL

      Table  . . . : DEMOCJ.T0110_REFERRAL
      Const Name . : UKEY2

      (C)opy column from the Table, indicate position in Key Columns
      using (A)fter/(B)efore, and press ENTER.
                                                                 Lines 1 to 7 of 15
                                                                       More:     +
      Act         Colname                          Column Type      UDT Length Nl FP
      ************************************ TOP **************************************
          CONSTRAINT KEY .:
          L   1   REFERRAL_NUM
          PARENT TABLE . .: DEMOCJ     T0110_REFERRAL                               
                  REFERRAL_NUM                     DECIMAL                 10   N  N  
                  AREA_NUM                         SMALLINT                     N  N  
                  CASE_NUM                         DECIMAL                 10   N  N  
                  CREATION_DT                      DATE                         N  N  
                  DISCOVERY_DT                     DATE                         N  N  
                  MAX_HIST_SEQ_NUM                 SMALLINT                     N  N
  7. Press END until the Mixed List panel is displayed.

    ALUSMXL ER   --------------------------- Mixed List ---------------------------
    Command ===>                                                    Scroll. . CSR
                                                                                  
    WORKID  . . . . : RDACRJ.UC01                                 Commands: CANCEL
                                                                                 
    Type action next to object and press Enter.                                   
       E=Edit  L=Like  D=Drop  U=Undo                                              
                                                           Objects 2 to 15 of 146
                                                                     More:   - +  
    Act     Object-Type    Objects                                                 
              TS . . . . .   DEMOCJ     ASCIIN3                                    
              TS . . . . .   DEMOCJ     ASCIIN4                                    
              TS . . . . .   DEMOCJ     CLAIMTS                                    
                TB . . . .     DEMOCJ     T0027_CLAIM                              
                  IXU. . .       RDACRJ     CLAIM                                  
                TB . . . .     DEMOCJ     T0110_REFERRAL                           
       *L         UCU. . .       DEMOCJ     T0110_REFERRAL      UKEY2
                TB . . . .     DEMOCJ     T0572_PROG_REF                           
              TS . . . . .   DEMOCJ     CUST01                                     
              TS . . . . .   DEMOCJ     CUST02                                     
                TB . . . .     DEMOCJ     EXAM_REPRT_CLASS                         
                TB . . . .     DEMOCJ     EXAMINATION                              
              TS . . . . .   DEMOCJ     N1

    Note

    The new unique constraint, designated by the UCU object type, is displayed below the table object.

  8. Press END until the WORKID Action Menu is displayed.
  9. Create or update a unique index for this unique constraint.Now that unique constraint has been created, you can analyze the work ID and execute the worklist.


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*