cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Rename Table script PowerDesigner

robert_kratschmann
Participant
0 Likes
1,556

Hi,

using DB2MVS11 (DB2 for z/OS v11) datasource. If a table will be renamed PowerDesigner is generating scripts like

...
drop table "tmp_TABLETT";
rename table TABLETT to "tmp_TABLETT";
...
insert into TABLETTSSS (C1, C2)
select C1, C2
from "tmp_TABLETT";

Searching for the definition of the rename table syntax I found
rename [table ][%OLDQUALIFIER%]%OLDTABL% to %NEWTABL%

So the %NEWTABL% will be taken from the %OLDTABL% by adding a "tmp_" prefix. Do we have the possiblity to change "tmp_" to another value and maybe restrict the length of %NEWTABL% to 15 characters in all Statements (DROP, RENAME, and INSERT)?

If I only modify %NEWTABL% variable with %[[?][-][<x>][.[-]<y>][<options>]:]<variable>% syntax only the rename table statement will be changed. Drop and Iinsert stay at "tmp_TABLETT".

Many thanks

Robert

View Entire Topic
former_member200945
Contributor
0 Likes

"tmp_" is hard coded in Powerdesigner coding engine.

It's not a good practice to replace "tmp_" by customizing DBMS.

The better way is store sql code in editor such as notepad. Use editor's replace function to modify table name.

It's not difficult to automate the process.

GeorgeMcGeachie
Active Contributor
0 Likes

I see what you mean, Phillip - the table name would would have to be tested for 'tmp_' in more than just the rename statement. We would also have to make sure that we didn't accidentally Drop the wrong table as well.