Toad World® Forums

Named NOT NULL constraints?

Hello,

I’d like to derive the names for NOT NULL constrainst from the name of the table.

How can I configre TDM to let me edit names for NOT NULL constraints?

Thanks!

bye

Thomas

Hi Thomas,

The most easiest way is to use Default Values in combination with Application Variables. Go to Settings Menu | Default Values, in the tree to the left locate Entities | Attributes and look for Constraint Not Null Name.

NNCC1.png

Edit the value in Default Value column and create the name using some combination of text and Application Variables (from the selection on the right), e.g. NC_<%TableName%>_<%UniqueNumber%>.

Apply the changes, restart TDM and you're done, from now on, every time a new Not Null Constraint is created, it will use the Default Value you have specified. This approach has one disadvantage - if you change the table name at some point, the changes won't be reflected in the Not Null Constraint name.

Another way to change the names is to use a script. You can try running the script attached to this post in Expert Mode Menu | Scripting Window (enable Expert Mode first in Settings Menu | Options | General). The script should rename all of your Not Null Constrait Names to NNentity_name_attribute_name. _Of course, you can modify the script to rename the objects to anything you want.

We have also created an enhancement change request (TDM-2369) to implement Application Variables evaluation directly for Not Null Constraints so your task could get a little easier in one of the future versions.

Regards,

Lukas
NotNullConstraintRename.txt (966 Bytes)

Hello!

This has been implemented in version 6.3 which can be downloaded at support.quest.com/…/download-new-releases

For more information about this release please have a look at the Releases Notes at support.quest.com/…/technical-documents

Thanks,
Zaida