Altering sequence aliases

You can alter a sequence alias to specify a different target sequence, or sequence on which the alias is defined.

About this task

Restriction: The target sequence cannot be any of the following items:
  • An existing sequence alias
  • A sequence generated for an identity column
  • A sequence generated for a DOCID column

Procedure

To alter a sequence alias:

  1. On the DB2 Administration Menu (ADB2) panel, specify option 1, and press Enter.
  2. On the System Catalog (ADB21) panel, specify any selection criteria at the bottom, specify option Q, and press Enter.
  3. On the Sequence Objects (ADB21Q) panel, specify ALT against the alias that you want to alter, and press Enter.
    Tip: To filter the list to display only aliases, type A in the search argument area in the T column, and press Enter.
    Figure 1. Sequence Objects (ADB21Q) panel
     ADB21Q in                  L7BB Sequence Objects              Row 256 from 502
     Command ===>                                                  Scroll ===> PAGE
                                                                                    
     Commands: GRANT                                                               
     Line commands:                                                                
      A - Auth  CRE - Create  AL - Alter  GR - Grant  DROP - Drop  DDL - Object DDL
      IDC - Identity columns  GEN - Generate DDL  F - Functions  J - Triggers      
      ? - Show all line commands                                    
                                                                                    
     Sel   Schema   Name              Owner    T C                      Start value
           *        *                 *        A *                                *
     ----- -------> ----------------- -------- - - --------------------------------
           SYSPUBLI EBPAL             TS5794   A N                                0
           TS5781   ALIAS000          TS6061   A N                                0
     ALT   TS5775A  PJOBALSQ          TS5775A  A N                                0
           TS5775A  PJALTST           TS5775A  A N                                0
           TS5775A  PJSEQALCM         TS5775A  A N                                0
           TS5772   S2213SEQALIAS     TS5772   A N                                0
           TS5775A  PJALSEQ2          TS5775A  A N                                0
           SYSPUBLI PJALSEQ2          TS5775A  A N                                0
           SYSPUBLI ALONSEQ           TS5774A  A N                                0
           SYSPUBLI PJALSSEQ3         TS5775A  A N                                0
           TS5775A  PJSEQALCM2        TS5775A  A N                                0
           TS5816   TUJSEQ1_ALIAS     TS5816   A N                                0
     ******************************* END OF DB2 DATA *******************************
  4. On the Redefine Sequence Alias (ADBP7QAL) panel, specify a different target sequence under FOR SEQUENCE:
    Figure 2. Redefine Sequence Alias (ADBP7QAL) panel
    ADBP7QAL ------------- L7BB Redefine Sequence Alias ------
    Command ===> 
                                                                 
    Commands: NEXT                                                
                                                             
     Redefine ALIAS                                               
                                                                  
     Schema . . . : TS5775A                                       
     Name . . . . : PJOBALSQ                                      
                                                                  
     FOR SEQUENCE                                                 
                                                                 
     Schema . . . . TS5775A             > (? to look up)          
     Name . . . . . PJOBSQ              > (? to look up) 
  5. Specify NEXT, and press Enter.
    The Alter Objects (ADB27CA) panel is displayed. Notice that the Ty column for your object indicates the type is SA for sequence alias.Start of change
    ADB27CA ------------------------ L7BB Alter Objects ---------- Row 1 to 1 of 1 
    Command ===>                                                  Scroll ===> PAGE 
                                                                                   
    Commands: NEXT  - Generate jobs  ADD - Add objects                             
     ALTOPT  - Change alter options                                                
    Line commands:                                                                 
     A - Alter object  D - Delete  S - Select object  REL - Alter related          
     FK - Add FK-affected tables  RI - Add RI-related tables  E - Edit view DDL    
     ? - Show all line commands         
                                                                                   
        Object   Object                                      RI RI  FK             
    Sel Qual     Name               Ty Info 1   Info 2     Rels Add Add Operation  
        *        *                  *  *        *             * *   *   *          
    --- -------> -----------------> -- -------> -------> ------ --- --- -----------
        TS5775A  PJOBALSQ           SA TS5775A  PJOBSQ          NA  NA  MODIFY     
    ******************************* END OF DB2 DATA *******************************
    End of change
  6. Generate an ALT job.