Databases Reference
In-Depth Information
Creating Objects
To support object creation, Analysis Services provides the
Create
command, which loads
the definition of the object to the server. Listing 26.2 shows the syntax of the
Create
command.
LISTING 26.2
The Syntax of the
Create
Command
<Create Scope=”Session” AllowOverwrite=”false”>
<ParentObject>object_reference</ParentObject>
<ObjectDefinition>
object_definition
.......
</ObjectDefinition>
</Create>
The
Create
command contains a reference to the parent object, inside of which you create
a new object. For example, when creating a cube or dimension, the parent object is a data-
base. The
object_definition
section contains the DDL definition of a cube or dimension.
You can specify two parameters on a
Create
command:
Scope
and
AllowOverwrite
. The
Scope
parameter creates cubes and dimensions on a session, so those objects are available
only to the user of the current session. To do this, specify the
Scope
parameter on the
Create
command and set it to
”Session”
. If you have not specified this parameter,
Analysis Services creates a server object that is available to all the users that have access
rights to it.
Use the
AllowOverwrite
parameter to specify how the
Create
command should behave
when an object with the same ID already exists on the server. If you create an object with
an identifier that matches an object that already exists on the server, Analysis Services can
either remove the existing object and replace it with a new one or return an error.
If you define
AllowOverwrite=”true”
(allowing Analysis Services to replace an existing
object with a new one), but an error happens during execution of the command, the new
object won't be created, and the old object won't be removed, because commands are
executed atomically. (We discuss atomic execution of the commands later in this chapter.)
When the
Create
command overwrites an existing object, the old object is deleted, and a
completely new object with the same identifier and a version number of
1
is created on
the server. If the old object had data associated with it—for example, a dimension or
cube—you have to process the new object before users can access the data.
Editing Objects
You can use the
Alter
command to change objects that already exist in the system. The
Alter
command replaces the old definition of the object with a new one. Listing 26.3
shows the syntax of the
Alter
command.
Search WWH ::
Custom Search