Toad World® Forums

Naming Convention

Is it possible to define the naming convention of primary key name based on the table name, such case PK[TableName]?



I have the same question as this person. Where can I specify a template for primary key names to include the table name, i.e. PK_<%TableName%>?

I want to be able to name the unique indexes that are not PK with AK01_<%TableName%>, AK02_<%TableName%> etc. Is it possible?

What about the relationship names? I want the template for the name to be FK_<%ChildTable%>To<%ParentTable%>.



such settings cannot be defined in naming conventions. Please define default values for new objects for defined target database.

Click Settings | Default values...
New dialog opens. Make changes (see screenshot) and restart TDM.

More can be found at:

Regarding alternate keys. It is possible to define settings for both primary and alternate keys in one item (Keys). Currently there is no separate option just for primary and another for alternate keys. We will work on that.



Thank you

Hi, related to this, I did set the default values as shown in the screen shot (I restarted TDM as well), however, I noticed the following behavior:

I add a new entity. Its name is set to Entity1 (it is the first one in the model). I change its name to something else, let’s say Table1. I click the Apply button to make the name change permanent. I go to the Keys tab and I click the Add button. The new PK has its name set to PK_Entity1. It doesn’t seem to take into account the new name. It should have been PK_Table1. I even saved the model before I added the PK it does the same thing.

Am I missing something? This is a physical model for sql server 2008.



you can use the Rename Primary Keys macro.


This macro is one of the in-built macros that should help you to automate various modeling tasks.

Another nice macro that you might find useful is accessible via menu Macros - Productivity.
This can be used for adding _ID attribute to all or selected tables:


Custom form: