Problem in Automatically generated columns while copying schema

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rahul B

    #1

    Problem in Automatically generated columns while copying schema

    Hi,

    I have a table where one of the columns is automatically generated as
    a substring of values of some other column.
    When i create a copy of that schema using sysproc.admin_c opy_schema,
    the table goes in pending state, because the data in the table was
    inserted fully and the column was not automatically generated(i think
    this is the reason).

    I tried to get it out of pending state by issuing "SET
    Integrity...... ..." and Reorg table ......." commands.
    But nothing worked.
    I can't even delete data from that table, nor do a select or update.

    So i had to resort to drop that table, and in turn drop a few procs/
    funcs to drop that.
    then recreate that table with DDL scripts, recreate other procs/
    funcs.

    Finally, i had to insert data like
    "Insert into schema2.table(c ol1, col2........... ......col(n-1)) select
    col1, col2, col3, .....col(n-1) from schema1.table"

    so that the column n was automatically generated.

    I am quite sure, this was only a workaround and not the correct way(I
    am working in a dev database, and not a prod one, so, the workaround
    was quite effective).

    Can anybody please help as how to tackle the problem in a correct way?

    Thanks

    Rahul

Working...