Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2003
    Posts
    127

    Unanswered: Altering a column ...

    Hi, Any problem wit hthe syntax below:

    ALTER TABLE WSI.DATAFEED ALTER COLUMN CAT_ID SET GENERATED AS IDENTITY (START WITH 1000 INCREMENT BY 1 CACHE 5)

    Does the table have to be in check pending before alter statement is run?

    Thnx

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The syntax look OK. This should alter the column to always generate the identity value on insert. Make sure this is what you want/need. I do not think the table needs to be in a check pending state.

    Andy

  3. #3
    Join Date
    Jun 2003
    Posts
    127
    This keeps throwing messages.

    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0104N An unexpected token "GENERATED AS IDENTITY (START WITH 1000" was
    found following "ER COLUMN CAT_ID SET". Expected tokens may include:
    "<space>". SQLSTATE=42601

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What DB2 version and OS?

    Andy

  5. #5
    Join Date
    Jun 2003
    Posts
    127
    Its DB2 8.1 fix12 on AIX 5.2 fix6

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I do not know what the problem is. I just ran the following successfully:

    ALTER TABLE ANDY.CITIES ALTER COLUMN CODE SET GENERATED AS IDENTITY ( START WITH 0 INCREMENT BY 1 NO CACHE ) ;

    Andy

  7. #7
    Join Date
    Jun 2003
    Posts
    127
    Thanks for checking. I'll try another server. What db2 level are u at? Is it AIX?

  8. #8
    Join Date
    Jun 2003
    Posts
    127
    Thanks. It works. My mistake. A typo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •