Customization > Automation Interface > Functions > For Models > CloneModelToOtherRep function (automation interface)
  
CloneModelToOtherRep function (automation interface)
Syntax:
CloneModelToOtherRep ("\\SQL\<server source>\<repository source>\<model>\<version>", "<new model name>", <retain permissions 1 or 0>, "\\SQL\<server destination>\<repository destination>")
Where:
<server source> is a string that specifies the name of the server on which the Database resides. The case of the name must be correct.
<repository source> is a string that specifies the name of the Database that owns the Model you want to clone. The case of the name must be correct.
<model> is a string that specifies the name of the Model you want to clone. The case of the name must be correct.
<version> is a string that specifies the version of the Model you want to clone. If the Model has not been versioned, the version is 0.
<new model name> is a string that specifies the name for the new cloned model.
<retain permissions 1 or 0> is a numeric value that specifies whether access permissions are retained in the cloned Model:
1 retains the access permissions of the Model being cloned.
0 sets the access permissions of the new Model to that of the owning Database, assuming some have been set. If no access permissions have been set up for the Database, the user that creates the Model is granted Owner access permissions to the model and all Packages, and the Public Write check box is selected for the model.
<server destination> is a string that specifies the name of the server on which the cloned model will reside. The case of the name must be correct.
<repository destination> is a string that specifies the name of the Database on which the cloned model will reside. The case of the name must be correct.
The CloneModelToOtherRep function clones a model version to another repository.
This function returns the reference of the new cloned model.
Examples
This example clones version 0 of the MyModel model in the MyDatabase database to the MyOtherRepository repository, names the new model MyClonedModel, and retains the access permissions.
Set objManager = CreateObject("Studio.ModelManager")
objManager.CloneModelToOtherRep("\\SQL\MyServer@MODELER\MyDatabase\MyModel\0","MyClonedModel",1,"\\SQL\MyServer@MODELER\MyOtherRepository")