Using domains with check constraint rules in TDM 3


I am trying to use domains in my physical modeling (MS SQL 2005) and assign some check constraint rules to them. However, to generate proper DDL scripts, I don’t know how to make the check constraint rule as a “macro” that will generate a proper script for every column where this domain (and the connected rule) will be used.

I create a domain “SurrogateKey” and assign this domain to columns in different tables, like “CompanyId”, “PersonId”. I create a check constraint rule “PositiveNumber” and I apply this rule to my “SurrogateKey” domain. How to write the SQL for this rule so that it will be used for every column?
I tried to find some solutions online. I think in TDM 2 the solution was to use macro %values% and write something like this:

%value% > 0

but this is not working for me in TDM 3.

Is there some kind of a document macro list which can be used in TDM 3?

If I am missing something, please let me know. Thank you for any answer.


Unfortunately, macros are not supported in TDM version 3 for now.
Anyway, we will deal with this task. It’s already been entered as request CR # 38 986.

Thanks very much for your patience.



Thank you for your answer.

Unfortunately, looking at your response, may I suggest that “Check constraint rules…” functionality is disabled in TDM 3 future releases, until it can actually be used. Now it is practically useless and it’s existence is therefore misleading to new users (of course, the same rule should be applied for possibly any other functionality which can not actually be used).


Thank you for your suggestion. We will discuss it in our team. CR # 43 654.

Thanks again.



We also need the ability to add check constraints to domains.
There needs to be some way to get the generated SQL to substitue the actual column name.

Thanks Malcolm for your remarks on this issue.

All this wil be taken into consideration.



Any time frame on macro support ? IMHO this is a must (and is a feature allready present in earlier TDM versions !!)


there are two Application Variables (earlier called macros) avaiable. %TableName% and %ColumnName%

A simple flash movie shows how to use application variable in Domains:



I know this post quite old. but I am wondering what version of TDM supports such Application Variables. My TDM is of 6.3.2, but it doesn't support ColumnName in Check Constraints template.


Hi Autumn,
version 6.3 already supports it. See screenshot

You can use app.var. "ColumnName" in attribute check constraint. In this case it return attribute/column of this check constrain.
Be aware that it is not available for Entity Constraints.

Best Regards