How to: Script Analysis Services Objects

There are several object types in Microsoft SQL Server Analysis Services that can be managed by using scripts. This list of objects includes the elements of an Analysis Services database. Specifically, this list of objects includes data sources, data source views, cubes, dimensions, mining structures, and roles.

To create, change, or delete objects by using scripts in Analysis Services, you can use SQL Server Management Studio and you should be conversant with XML for Analysis (XMLA). However, SQL Server Management Studio has a feature that automatically creates the XMLA script required to create objects, such as cubes. This automation feature helps you reduce the learning curve for XMLA.

Note

For more information about how to use XMLA, see Using XML for Analysis in Analysis Services (XMLA).

Important

When scripting the Role Object, you need to be aware that security permissions are contained by the objects they secure rather than with the security role with which they are associated.

To script Analysis Services objects

  1. In SQL Server Management Studio, connect to an instance of Analysis Services.

  2. Locate the object for which you want to create a script that either creates, alters, or deletes objects.

  3. Right-click the object, point to Script Cube as, point to CREATE To, ALTER To, or Delete To, and then click one of the following options: New Query Editor Window to open the query editor window, File to save the XMLA script to a file, or Clipboard to save the XMLA script to the Clipboard.

    Note

    Typically, you would select File if you want to create multiple different versions of the file.