CloneModel function (automation interface)
Syntax:
CloneModel (\\SQL\<server>@<instance>\<database>\<model>\<version>", "<new model name>", <retain permissions 1 or 0>)
Where:
• <server> is a string that specifies the name of the server on which the Database resides. The case of the name must be correct.
• <database> 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.
The CloneModel function clones a model to the same database.
This function returns the reference of the new cloned model.
Examples
This example clones a model named MyModel in the MyDatabase database, names the new model My Cloned Model and retains the access permissions.
Set objManager = CreateObject("Studio.ModelManager")
objManager.CloneModel("\\SQL\MyServer@MODELER\MyDatabase\MyModel\0","My Cloned Model",1)