<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Rename Table script PowerDesigner in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495308#M90358</link>
    <description>&lt;P&gt; "tmp_" is hard coded in Powerdesigner coding engine. &lt;/P&gt;
  &lt;P&gt; It's not a good practice to replace "tmp_" by customizing DBMS.&lt;/P&gt;
  &lt;P&gt; The better way is store sql code in editor such as notepad. Use editor's replace function to modify table name.&lt;/P&gt;
  &lt;P&gt; It's not difficult to automate the process.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2017 18:49:18 GMT</pubDate>
    <dc:creator>former_member200945</dc:creator>
    <dc:date>2017-11-02T18:49:18Z</dc:date>
    <item>
      <title>Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaq-p/495301</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;using DB2MVS11 (DB2 for z/OS v11) datasource. If a table will be renamed PowerDesigner is generating scripts like &lt;/P&gt;
  &lt;P&gt;...&lt;BR /&gt;drop table "tmp_TABLETT";&lt;BR /&gt;rename table TABLETT to "tmp_TABLETT";&lt;BR /&gt;...&lt;BR /&gt;insert into TABLETTSSS (C1, C2)&lt;BR /&gt;select C1, C2&lt;BR /&gt;from "tmp_TABLETT";&lt;BR /&gt;&lt;BR /&gt;Searching for the definition of the rename table syntax I found&lt;BR /&gt;rename [table ][%OLDQUALIFIER%]%OLDTABL% to %NEWTABL%&lt;BR /&gt;&lt;BR /&gt;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)?&lt;BR /&gt;&lt;BR /&gt;If I only modify %NEWTABL% variable with %[[?][-][&amp;lt;x&amp;gt;][.[-]&amp;lt;y&amp;gt;][&amp;lt;options&amp;gt;]:]&amp;lt;variable&amp;gt;% syntax only the rename table statement will be changed. Drop and Iinsert stay at "tmp_TABLETT".&lt;BR /&gt;&lt;BR /&gt;Many thanks&lt;BR /&gt;&lt;BR /&gt;Robert&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 08:45:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaq-p/495301</guid>
      <dc:creator>robert_kratschmann</dc:creator>
      <dc:date>2017-10-25T08:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495302#M90352</link>
      <description>&lt;P&gt;hello Robert&lt;/P&gt;
  &lt;P&gt;There appear to be two parts to your question -&lt;/P&gt;
  &lt;OL&gt;
   &lt;LI&gt;&lt;EM&gt;How do I limit the table names to 15 characters?&lt;/EM&gt; The table name in the DDL is taken from the 'Code' of the table in the PDM - in the Database Definition file you can control the maximum length of table names See Maxlen, under Script\Objects\Table. Why do you want to keep your table names so short? 15 characters seems really unmanageable - you'll probably have to manually amend them to avoid duplicates, no matter how many abbreviations you use.&lt;/LI&gt;
   &lt;LI&gt;&lt;EM&gt;Can I change the name of the temporary table that the script creates?&lt;/EM&gt; I don't think you can, but why would you want to do that?&lt;/LI&gt;
  &lt;/OL&gt;
  &lt;P&gt;By the way, you probably already know that you can tell PD not to create temporary tables in the DB alter script - I'm not a DBA or DB Developer, so I can't say whether or not that's a good idea &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 14:07:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495302#M90352</guid>
      <dc:creator>GeorgeMcGeachie</dc:creator>
      <dc:date>2017-10-26T14:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495303#M90353</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;
  &lt;P&gt;the database will use "tmp_" also as prefix for internal tables, so the tables generated by PowerDesigner should not interfer with these tables. The length itself was only an additional question.&lt;/P&gt;
  &lt;P&gt;Robert&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 08:54:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495303#M90353</guid>
      <dc:creator>robert_kratschmann</dc:creator>
      <dc:date>2017-10-27T08:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495304#M90354</link>
      <description>&lt;P&gt;It looks like you need to change the script that PD generates when renaming tables, which is in the database definition file at &lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;Script\Objects\Table\Rename&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;I haven't tried it myself, but I think this will work. If the first 4 characters of the new table name are "tmp_", it produces a different new table name which is the string "drp_" followed by the original table name:&lt;/P&gt;
  &lt;P&gt;.if .4:%NEWTABL% == "tmp_"&lt;BR /&gt;alter table [%QUALIFIER%]%OLDTABL%&lt;BR /&gt; rename to drp_%OLDTABL%&lt;BR /&gt;.else&lt;BR /&gt;alter table [%QUALIFIER%]%OLDTABL%&lt;BR /&gt; rename to %NEWTABL%&lt;BR /&gt;.endif&lt;/P&gt;
  &lt;P&gt;Please let me know if this works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 11:07:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495304#M90354</guid>
      <dc:creator>GeorgeMcGeachie</dc:creator>
      <dc:date>2017-10-27T11:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495305#M90355</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;
  &lt;P&gt;we had two holidays, so sorry for the delay.&lt;/P&gt;
  &lt;P&gt;Where should I enter your if-condition? I tried it in the &lt;/P&gt;
  &lt;P&gt;"DB2MVS11::Script\Objects\Table\Rename"-area instead, before, and after the line containing&lt;/P&gt;
  &lt;P&gt;rename [table ][%OLDQUALIFIER%]%OLDTABL% to %NEWTABL% ?&lt;/P&gt;
  &lt;P&gt;I allways get in the SQL-Script for the rename-modification &lt;/P&gt;
  &lt;P&gt;alter table TABLETT drop primary key;&lt;BR /&gt;drop index INDEX_1;&lt;BR /&gt;drop table "tmp_TABLETT";&lt;/P&gt;
  &lt;P&gt;1 error(s), 0 warning(s) (1) (Table "TABLETT"):&lt;BR /&gt; [syntax error] condition parsing error&lt;/P&gt;
  &lt;P&gt;...&lt;/P&gt;
  &lt;P&gt;Many thanks&lt;/P&gt;
  &lt;P&gt;Robert&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 07:52:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495305#M90355</guid>
      <dc:creator>robert_kratschmann</dc:creator>
      <dc:date>2017-11-02T07:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495306#M90356</link>
      <description>&lt;P&gt;The script is meant to completely replace the existing script. Thanls for noticing that I should have put %OLDQUALIFIER% instead of %QUALIFIER% - not sure where that came from.&lt;/P&gt;
  &lt;P&gt;If you want to keep the existing line, putting a full stop (.) at the beginning of the line will turn it into a GTL comment.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 11:13:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495306#M90356</guid>
      <dc:creator>GeorgeMcGeachie</dc:creator>
      <dc:date>2017-11-02T11:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495307#M90357</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;
  &lt;P&gt;using&lt;/P&gt;
  &lt;P&gt;.if %.5:NEWTABL% == "tmp_&lt;BR /&gt; rename [table ][%OLDQUALIFIER%]%OLDTABL% to drp_%OLDTABL%&lt;BR /&gt;.else&lt;BR /&gt; rename [table ][%OLDQUALIFIER%]%OLDTABL% to %NEWTABL%&lt;BR /&gt;.endif&lt;/P&gt;
  &lt;P&gt;will lead into the following SQL script to rename the TABLETT Table:&lt;/P&gt;
  &lt;P&gt;alter table TABLETT drop primary key;&lt;BR /&gt;drop index INDEX_1;&lt;BR /&gt;drop table "tmp_TABLETT";&lt;BR /&gt;rename table TABLETT to drp_TABLETT;&lt;BR /&gt;create table ...&lt;BR /&gt;insert into TABLETTSSSS (C1, C2) select C1, C2 from "tmp_TABLETT";&lt;/P&gt;
  &lt;BR /&gt;
  &lt;P&gt;On one position the drp_TABLETT will be used but on all other positions he'll use tmp_TABLETT instead of dmp_TABLETT. I think the variable %NEWTABL% must be set qlobal?&lt;/P&gt;
  &lt;P&gt;Robert&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 14:00:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495307#M90357</guid>
      <dc:creator>robert_kratschmann</dc:creator>
      <dc:date>2017-11-02T14:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495308#M90358</link>
      <description>&lt;P&gt; "tmp_" is hard coded in Powerdesigner coding engine. &lt;/P&gt;
  &lt;P&gt; It's not a good practice to replace "tmp_" by customizing DBMS.&lt;/P&gt;
  &lt;P&gt; The better way is store sql code in editor such as notepad. Use editor's replace function to modify table name.&lt;/P&gt;
  &lt;P&gt; It's not difficult to automate the process.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 18:49:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495308#M90358</guid>
      <dc:creator>former_member200945</dc:creator>
      <dc:date>2017-11-02T18:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Table script PowerDesigner</title>
      <link>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495309#M90359</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 11:59:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rename-table-script-powerdesigner/qaa-p/495309#M90359</guid>
      <dc:creator>GeorgeMcGeachie</dc:creator>
      <dc:date>2017-11-06T11:59:56Z</dc:date>
    </item>
  </channel>
</rss>

