Archives of the TeradataForum
Message Posted: Thu, 08 Apr 2004 @ 17:08:42 GMT
Subj: | | Re: Erwin and Soft RI |
|
From: | | Maxwell, Donald |
The only possibility I can think of is to use a table-level post script to ALTER TABLE ADD FOREIGN KEY ... WITH NO CHECK OPTION. This would
mean that you would choose not to have Erwin forward engineer referential integrity, the post-script would be completely responsible.
I have had problems with the syntax of the ALTER TABLE statement with the soft RI option. The documentation says it should work, but I get a
syntax error on my release ( 5.0.2 ).
Nonetheless, if you try this approach, I would suggest you create a UDP on the relationship called CheckOption, with a type of "list" and a
default value of WITH NO CHECK OPTION, WITH CHECK OPTION. The first item in the list (seperated by commas) is the default for this UDP for all
relationships. Add a table-level post-script, called SoftRI, which would would look something like:
%ForEachChildRel() {
ALTER TABLE %If(%TableOwner) {%TableOwner.}%TableName
ADD FOREIGN KEY (%ChildFK(",")) REFERENCES %RelPhysProp(CheckOption)
%ForEachTable(%Parent) {%If(%TableOwner) {%TableOwner.}%TableName}
(%ParentPK(","))%DBMSDelim}
Attach the table-level post-script to the tables for which you would like soft RI, and check the forward engineer Table option - post-
script.
Donald Maxwell
|