Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2011
    Posts
    30

    Unanswered: row change timestamp error

    version db2 9.5

    i am trying to create the below table

    CREATE TABLE "ABC".table1 (
    ts TIMESTAMP NOT NULL GENERATED ALWAYS FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP,
    part INTEGER GENERATED ALWAYS AS (month(ts))
    );

    but getting following error
    Error:8/20/2012 10:36:41 PM 0:00:02.250: DB2 Database Error: ERROR [42621] [IBM][DB2/AIX64] SQL0548N A check constraint or generated column that is defined with "PART" is invalid. SQLSTATE=42621.

    could anyone please help me out to resolve this error??

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    The message text seems clear (from db2 ? SQL0548N)

    * the definition contains a reference to a generated column which is
    based on an expression
    * the check constraint is part of a column definition, and its
    check-condition contains a reference to a column name other than th
    column being defined

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    If you want the part column which was generated based on a ts column, view on the table might be a solution(not tested).

  4. #4
    Join Date
    Dec 2011
    Posts
    30
    thank you very much...

Posting Permissions

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