Toad World® Forums

TDM 4.3.3.6 model update and settings/default values problem (SQL 2012)


#1

Hello all,

in TDM I have set a default value for attribute default constraint names so that they meet SQL Server’s naming convetion (if you create the default values in SQL Server Management Studio). The default value is defined as follows:

DF_<%TableName%>_<%Name%>

When running a model update the wizard is showing a change for each attribute not having already a default constraint (see attached image).

If I accept the changes I will have many duplicate names in my model because the attribute name is missing. Plus I will have to adjust the default constraint name e.g. if I add a default value later.

Another question is whether the generated SQL scripts will have code for these columns (they don’t have a default constraint)?

Also I have noted that I have to restart TDM to make my changes have an effect, e.g. in my first try I have used <%FullTableName%> by accident. After fixing this TDM still was using <%FullTableName%> instead of <%TableName%>.

Thank you for your help and best regards,
Gerald


#2

I have tried to replace the attached image with an attached file (because of its size), but this did not work - so here it is as an attached file.
model_update_default_constraint_name.png


#3

Hi,

in general, when you change someting in the Default Values form, restart of TDM is required.

Re application variables: I will write you more information on Monday.

Regards,

Vaclav


#4

Hi,

the application variables cannot be used for object names.
What you can do is to write a macro that will rename objects accordingly to defined rules. You can find samples in Rename Objects Pack, see
http://www.toad-data-modeler.com/help/RenameObjectsPack.aspx

Settings <%FullTableName%> and <%TableName%> won’t work automatically.

Regards,

Vaclav


#5

Hi,

I don’t want to rename all relationship according to the naming convention (which would be very nice, but I still have to find time for looking into scripting). My goal is that new default constraints (created in TDM) will get a proper name, which works. But there is the side effect I have described in my first post.

During a model update TDM wants to assing a default constraint name to each column which does not have a default constraint. In my example (see picture in my second post) TDM wants to assign a default constraint name DF_Address_ to all columns which don’t have a default constraint (this is why the right side shows an empty default constraint name - there is no one in the model).

I will try to prepare an example if it helps you.

Regards,
Gerald


#6

Hi Gerald,

yes. Example would be perfect. Now I can only recommend you to make sure the option Resolve Application Variables is enabled in the Model Update process. See screenshot.

Regards,

Vaclav


#7

Hi Vaclav,
here are the steps to reproduce my problem:

  1. create a new SQL Server Database
  • create a new table (see attached file)

  • create a new TOAD Model

    make sure that Settings/Default Values/Entities/Attributes/Default Constraint Name is empty
    
  • run Model Update

    I have used the following settings:
    Database RE (Microsoft SQL Server 2012)
    Connection via ADO (SQL Server Native Client 11.0)
    Compare all without graphics
    
  • set Settings/Default Values/Entities/Attributes/Default Constraint Name to DF__

  • restart TDM

  • run Model Update

  • The comparison screen will look like the attached image if Resolve Application Variables is checked (if not all constraint names will be DF__).

I know from your previous replies and another forum question (Default values for NotNull Constraint partly work) that I should not use an expression like above. But nevertheless - why does Model Update assign a default constraint name to all columns (although they don’t have a default constraint).

I would not care because as long as no default value is assigned to a column script generation will not create code, but model verification keeps complaining about name uniqueness which makes finding “real” errors in a large model difficult.
GenericTable.sql (830 Bytes)


#8

Hi Vaclav,
here are the steps to reproduce my problem:

  1. create a new SQL Server Database
  • create a new table (see attached file)

  • create a new TOAD Model

    make sure that Settings/Default Values/Entities/Attributes/Default Constraint Name is empty
    
  • run Model Update

    I have used the following settings:
    Database RE (Microsoft SQL Server 2012)
    Connection via ADO (SQL Server Native Client 11.0)
    Compare all without graphics
    
  • set Settings/Default Values/Entities/Attributes/Default Constraint Name to DF__

  • restart TDM

  • run Model Update

  • The comparison screen will look like the attached image if Resolve Application Variables is checked (if not all constraint names will be DF__).

I know from your previous replies and another forum question (Default values for NotNull Constraint partly work) that I should not use an expression like above. But nevertheless - why does Model Update assign a default constraint name to all columns (although they don’t have a default constraint).

I would not care because as long as no default value is assigned to a column script generation will not create code, but model verification keeps complaining about name uniqueness which makes finding “real” errors in a large model difficult.


#9

Hi Gerald,

see my asnwer at:
http://modeling.inside.quest.com/thread.jspa?messageID=141045&#141045

Regards,

Vaclav


#10

Hi Vaclav,
see my reply in the other thread.
Regards,
Gerald