Hi all,
I'm new on DB2 so would like to ask if there is smart way for move/copy index from one table to another(set of columns are the same).
So generally we have 2 identical tables A and B, table B has no indexes, and I would like to create same set indexes on table B , as we have on table A.
Offcourse we can do DB2 stored procedure and dynamic SQL that will build string for creating new indexes based on syscat.Indexes data, but maybe there is more elegant way of achiving the goal, maytbe some copy/move index routine or like that. Flipping tables etc. is not possible in the case, so we need just "move indexes" from table A to table B.
As I can see there is also "db2look" command that looks like can output index DDL to out file, but not sure if it possible redirect output of the command to string varaible in DB2 SP dynamic SQL or open code.
Thanks in adwanced for any advices!
I'm new on DB2 so would like to ask if there is smart way for move/copy index from one table to another(set of columns are the same).
So generally we have 2 identical tables A and B, table B has no indexes, and I would like to create same set indexes on table B , as we have on table A.
Offcourse we can do DB2 stored procedure and dynamic SQL that will build string for creating new indexes based on syscat.Indexes data, but maybe there is more elegant way of achiving the goal, maytbe some copy/move index routine or like that. Flipping tables etc. is not possible in the case, so we need just "move indexes" from table A to table B.
As I can see there is also "db2look" command that looks like can output index DDL to out file, but not sure if it possible redirect output of the command to string varaible in DB2 SP dynamic SQL or open code.
Thanks in adwanced for any advices!