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.e.
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.
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).
Hi,
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.
Regards
Malcolm
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.
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.