# Naming Convention

**URL:** <https://forums.toadworld.com/t/naming-convention/2396>\
**Category:** Toad Data Modeler\
**Created:** [November 15, 2010, 7:04pm UTC](https://forums.toadworld.com/t/naming-convention/2396 "2010-11-15T19:04:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![km123](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@km123](https://forums.toadworld.com/u/km123)\
**Post date:** [November 15, 2010, 7:04pm UTC](https://forums.toadworld.com/t/naming-convention/2396/1 "2010-11-15T19:04:48Z")

</div>

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

Thanks.

---

<div class="post-metadata">

**Author:** ![costabas](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@costabas](https://forums.toadworld.com/u/costabas)\
**Post date:** [July 12, 2012, 6:38pm UTC](https://forums.toadworld.com/t/naming-convention/2396/2 "2012-07-12T18:38:28Z")

</div>

Hi:

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%\>.

Thanks!

---

<div class="post-metadata">

**Author:** ![Vaclav\_Frolik](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/vaclav_frolik/32/12_2.png) [@Vaclav\_Frolik](https://forums.toadworld.com/u/Vaclav_Frolik)\
**Post date:** [July 13, 2012, 4:35am UTC](https://forums.toadworld.com/t/naming-convention/2396/3 "2012-07-13T04:35:51Z")

</div>

Hi,

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:  
[http://blogs.inside.quest.com/modeling/2011/11/08/changing-default-relationship-names-in-tdm/](http://blogs.inside.quest.com/modeling/2011/11/08/changing-default-relationship-names-in-tdm/)

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.

Regards,

Vaclav

 ![keys-default-values.png](https://global.discourse-cdn.com/quest/original/2X/2/277e5f8b6e60c9fecb270ad75469f69094c7ef24.png)

---

<div class="post-metadata">

**Author:** ![costabas](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@costabas](https://forums.toadworld.com/u/costabas)\
**Post date:** [July 13, 2012, 12:55pm UTC](https://forums.toadworld.com/t/naming-convention/2396/4 "2012-07-13T12:55:16Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![costabas](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@costabas](https://forums.toadworld.com/u/costabas)\
**Post date:** [July 18, 2012, 3:42pm UTC](https://forums.toadworld.com/t/naming-convention/2396/5 "2012-07-18T15:42:43Z")

</div>

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.

Thanks

---

<div class="post-metadata">

**Author:** ![Vaclav\_Frolik](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/vaclav_frolik/32/12_2.png) [@Vaclav\_Frolik](https://forums.toadworld.com/u/Vaclav_Frolik)\
**Post date:** [October 20, 2014, 12:49am UTC](https://forums.toadworld.com/t/naming-convention/2396/6 "2014-10-20T00:49:43Z")

</div>

Hi,

you can use the **Rename Primary Keys** macro.

![rename-keys-1.png](https://global.discourse-cdn.com/quest/original/2X/7/77212b77987c80c293d8d22c035be901e1a28438.png)

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:

![add-attribute.png](https://global.discourse-cdn.com/quest/original/2X/2/2a57faebd5658d6e998175963a5760f18c2a13fe.png)

Custom form:

![new-attribute.png](https://global.discourse-cdn.com/quest/original/2X/1/1d6d1c9d0aa5e92922143b721571e21aa4b8e5c9.png)

Regards,

Vaclav
