This is a script that generates the SQL DDL for all constraints (Primary, Unique and Foreign Keys). It is useful if one wants to generate the SQL of all key constraints separated from the SQL of tables. To run it: 1) bring up the Script Explorer 2) right click on "User Defined" and select "New Script" 3) copy/paste the attachment into the edit control 4) hit the run button (the first icon in the toolbar above the edit control) Note: you can undo/redo the effects of this script as with any Model changes /********** start of script *************/ Sub Evaluate_OnLoad() Set Context = CreateObject("SCF.ScriptContext") Set Document = Context.ScriptDocument Set ThisScript = Context.Object Set Options = Context.Options Dim CreateStmt Set Model = ThisScript.Model Set Tables = Model.AsObject.Children("Table") For Each Table In Tables Set Constraints = Table.Children("Key Constraint") For Each Constraint in Constraints CreateStmt = Constraint.Evaluate("Create Script") Document.Write(CreateStmt & vbNewLine) Next Next For Each Table In Tables Set Relations = Table.Children("Relation") For Each Relation in Relations CreateStmt = Relation.Evaluate("Create Script") Document.Write(CreateStmt & vbNewLine) Next Next End Sub