Toad World® Forums

Key Name Generation


#1

I see in the PHysical Model settings, there are some abilities to auto-generate names. I would love to see something like TOAD for SQL Server, where the names are sensically and logicaly auto-generated. For instance, when I create a PK, it should not create Keyn (Key1, Key2, etc.). It should create PK_SchemaName_TableName_1. That’s the TOAD method. Better yet, have it create PK_SchemaName_TableName_PKColName.

Example:
Schema Name: dbo
Table Name: Sales
PK Col Name: SaleID

To access the column in SQL, I could write dbo.Sales.SaleID.

So, the PK should be named: PK_dbo_Sales_SaleID

This makes much logical sense!

Foreign Keys should be named similarly (following the TOAD model):
FK_SchemaName_TableName_1
Or better yet:
FK_SchemaName_TableName_FKColName (assuming the FKColName is known).
So, if the table Sales had a column called SellerID, the FK relationship might be called:
FK_dbo_Sales_SellerID


#2

Hi,

thank you for your suggestions, it makes sense, of course. Currently it is possible to define default values for new items like new keys and in settings you can specify names for FK, but using schema name in the object names is something what has not been implemented yet. You can use macros to rename objects accordingly, this might be a good workaround in case you wish to make batch changes in your model.

See http://www.toad-data-modeler.com/help/RenameObjectsPack.aspx

Regards,

Vaclav