This script will create a synonym in a "To Schema" for each Table in the "From Schema" (if it doesnt already exist). You should edit the FromSchemaName and ToSchemaName before running the script. 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 *************/ ' This script will create synonyms in a "To Schema" for all tables that are in a "From Schema" ' You can edit the To and From Schemas below (at the top of the Evaluate_OnLoad routine) to whatever you like Function ExistingSynonym(Synonyms, ToSchema, Obj) Set ExistingSynonym = Nothing For Each Synonym In Synonyms Set ReferencedObj = Synonym.Property("Referenced Object").AsObject If Not ReferencedObj Is Nothing And Obj.Equals(ReferencedObj) Then If Synonym.HasProperty("Owner") Then Set Schema = Synonym.Property("Owner").AsObject If Schema.Equals(ToSchema) Then Set ExistingSynonym = Synonym Exit Function End If End If End If Next End Function Sub CreateSynonym(ToSchema, Obj, Framework, Synonyms, Owner, Document) Set Existing = ExistingSynonym(Synonyms, ToSchema, Obj) If Existing Is Nothing Then Document.Write("Creating new Synonym for " & Obj.TypeName & " " & Obj.Name & vbNewLine) Set Synonym = Framework.CreateObject("Synonym", Owner) Set RefProp = Framework.CreatePropertyValue("Synonym", "Referenced Object") RefProp.FromObject(Obj) Synonym.SetProperty "Referenced Object", RefProp Set ToSchemaProp = Framework.CreatePropertyValue("Synonym", "Owner") ToSchemaProp.FromObject(ToSchema) Synonym.SetProperty "Owner", ToSchemaProp Set NameProp = Framework.CreatePropertyValue("Synonym", "Name") NameProp.FromString(Obj.Name) Synonym.SetProperty "Name", NameProp Else Document.Write("Synonym for " & Obj.TypeName & " " & Obj.Name & " already exists." & vbNewLine) End If End Sub Sub CreateSynonyms(FromSchema, ToSchema, Owner, ChildType, Framework, Synonyms, Document) Set Children = Owner.Children(ChildType) For Each Child In Children ' Document.Write("Checking " & Child.Name & vbNewLine) If Child.HasProperty("Owner") Then ' Document.Write(Child.Name & " has a Schema" & vbNewLine) If FromSchema.Equals(Child.Property("Owner").AsObject) Then Call CreateSynonym(ToSchema, Child, Framework, Synonyms, Owner, Document) End If End If Next End Sub Sub Evaluate_OnLoad() FromSchemaName = "Schema_1" ToSchemaName = "Schema_2" Set Context = CreateObject("SCF.ScriptContext") Set Document = Context.ScriptDocument Set ThisScript = Context.Object Set Model = ThisScript.Model Set Framework = CreateObject("SCF.ScriptFramework") Set Synonyms = Model.AsObject.Children("Synonym") Set Schemas = Model.AsObject.Children("Schema") Set ToSchema = Nothing Set FromSchema = Nothing For Each Schema In Schemas If Schema.Name = ToSchemaName Then Set ToSchema = Schema End If If Schema.Name = FromSchemaName Then Set FromSchema = Schema End If If Not ToSchema Is Nothing And Not FromSchema Is Nothing Then Exit For End If Next If ToSchema Is Nothing Then Document.Write("Unable to find To Schema with Name " & ToSchemaName & vbNewLine) Exit Sub End If If FromSchema Is Nothing Then Document.Write("Unable to find From Schema with Name " & FromSchemaName & vbNewLine) Exit Sub End If Document.Write("Creating Synonyms for Objects in Schema " & FromSchemaName & " To Schema " & ToSchemaName & " in Model " & Model.AsObject.Name & vbNewLine) Model.BeginTransaction("Create Synonyms") Call CreateSynonyms(FromSchema, ToSchema, Model.AsObject, "Table", Framework, Synonyms, Document) Model.EndTransaction() Document.Write("Done Creating Synonyms in Model " & Model.AsObject.Name & vbNewLine) End Sub