How to set default name for new default constraints?

Hi All,

I’ve used the “Default Values” dialog box to set default names and captions for new foreign key relationships, and that is very useful because I’ve failed to set all of our object names correctly in the past. I mistakenly assumed the “Defaults” item in the left pane of the Default Values was for new default constraints, but it’s not. Is there some way to set the default name for new default constraints? For us, our naming convention demands that default constraints be named “df_[table name]_[column name]”.

All of our models for SQL Server 2014.

Thanks for your help,

-Eric B.

Hi Eric,
you can also use the "Default Values" dialog to set default names for new default constraints. Go to the menu Settings | Default Values and set the value of "Default Constraint name" to "df_<%TableName%>_<%Name%>" (without the quotes). If you create a new attribute after the restart of TDM, the name of default constraint will be set.

But there is a small limitation. It does not work if you create a new attribute by the Add or Add+OK buttons because the default name of attributes is "AttributeX" and this name will be used in the constraint name. Instead of you have to specify the new attribute with correct name in appropriate edit box on the tab Attribute.

7444.AddColumns.jpeg

Regards,

David

Fantastic, David, thank you very much! This is exactly what I was looking for. I appreciate the limitation explanation, too.

-Eric

Darn, it quit working. It worked a few times and then stopped substituting the entity name for <%TableName%>. Here's my configuration:

config.png

But for some reason, only <%Name%> is resolving properly. For some reason, <%TableName%> seems to resolve to an empty string.

Any idea what I could be doing wrong? I assume I changed some other configuration property that is causing this issue.

Thanks,
Eric

Hello Eric,

I’m sorry but it’s hard to say what causes this problem because it works for me. Did you change some other default values? What version of TDM do you use? Could you send us the user package (My Package.txg) where are these default values stored? You can find it on this path e.g. c:\Users\David\Documents\Toad Data Modeler Beta\Packages{DCB5CB9B-CF65-4350-86B5-285D246FC5AC}.

Thanks,

David

Hi David,

Thank you very much for your time. We are using Toad Data Modeler 5.4 Freeware. Yes, I have changed other Default Values configurations, mostly to experiment because I'm still not a proficient Toad user. I sent you the the user package contents in a separate email. Again, thank you for your assistance.

I'll add screenshots of changed Default Values below in hopes that another viewer might see some change I've made that could be causing my problem of incorrect default constraint names. I included all green colored Default Values, though I'm not sure if I made those changes or if those are the default values presented in green for some reason.

Is there some way to reset all of the Default Values changes I've made?

Thanks,
Eric B.

entities.png

keys.png

FileTables.png

ModelTitle.png

Relationships.png

Sequences.png

Hi Eric,

sorry for my late reply. I’ve tried your package in the current freeware version 6.1 (version 5.4 should be expired yet) and without problem. I was not able to simulate problem with evaluation application variable <%TableName%> in the default value constraint name.

Some green colored default values are green although the are unchanged by you (they are inherited). And there is no simple way to reset all default values except delete My Package.txg (you can find it here c:\Users\DAVID\Documents\Toad Data Modeler\Standard Installation 6.1\Packages{DCB5CB9B-CF65-4350-86B5-285D246FC5AC}) Close TDM, delete this package (but backup it) and start TDM. New My package will be created with default settings.

David