override system script method


I would like to modify the sql generation script to remove comments like "-- Create tables section".

I tried to create a sub script by right clicking in the script explorer (Toad Data Modeler -> CSAO Class Definitions -> ConvertorRule Microsoft SQL Server -> ConvertorRulePEREntityMS12MS12).

In the new script I override the CreateEntity function to modify it (l.125 of the new file) :

// Generate table comments and column comments
if (false)//(DCGenerator.CreateComments)

But it doesn't seem to work.

How can I achieve this ?

I attach a screenshot.


Hello there,

You can edit a system package and customize the generated code by following these steps:

  1. In Package Explorer, expand the Physical Entity Relationship Model package, go to Scripts, right-click PERTemporaryTools and choose Properties. On the General tab, click Unlock Package.

  1. Open the script and add the following function to it:

function RemoveComments(Stream)
// Loads the generated script into the variable
var Text = Stream.Text;
// Breaks the script into an array of lines
var Lines = Text.split('\n');
// Gets the total number of lines
var lengthArray = Lines.length;
var substr, i;

 for(i = lengthArray - 1; i >= 0; i--) 
    // Get the first two characters of a line 
    substr = Lines[ i ].substr(0,2);
    // If they are "--" (indicating a comment), delete the line content   
    if (substr=='--')     
       Lines[ i ] = '';                     
 // Join the edited lines into one string and return the result   
 return Lines.join('\n');  


  1. Navigate to the RunPromptly function and add the following line between Generator.Generate(); and **Stream.OverwriteWarning = true;

    Stream.Text = RemoveComments(Stream);


  1. Save the script and try to generate the model. This time, there should be no comments. The function you added to the script deletes them.
    Note that the function deletes all comments, if you want it to do something different, feel free to customize it to your liking. The scripting language used is JScript.



Hello Lukas,

Thanks a lot for your answer, it works perfectly !