dbTalk Databases Forums  

AMO question - deleting partition

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss AMO question - deleting partition in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jesse O.
 
Posts: n/a

Default AMO question - deleting partition - 04-11-2006 , 06:26 PM






It seems my code isn't removing the partition from the measure group. It
logs it as being successful, however the partition still remains.

Any ideas?

Thanks.




Dim oPartition As Partition

oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e)

objMeasureGroup.Partitions.Remove(oPartition)

objMeasureGroup.Update()



Reply With Quote
  #2  
Old   
Adrian Dumitrascu [MS]
 
Posts: n/a

Default Re: AMO question - deleting partition - 04-12-2006 , 03:44 PM






In order to remove a major object (Partition included; other major object
examples: Dimension, DataSource, Cube, MiningStructure, MiningModel), you
need to call .Drop() method on that object.

oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e);
oPartition.Drop();


The .Drop method removes the object from the AMO structures and also from
the server.
The .Remove method only removes the object from the AMO collection, but not
from the server (like in the code
objMeasureGroup.Partitions.Remove(oPartition)).
The .Update() method saves the properties and minor collections of an object
(but does nothing for its major children), so in the code below, the
objMeasureGroup.Update() would not propagate the Partition removal from
AMO's structures to the server.
There is an overload for the .Update method (with ExpandFull option) that
fully saves an object to the server (so you can delete a major object with
..Remove and then a full Update on it parent, but this will be way too costly
compared to the .Drop method).

Adrian.



"Jesse O." <jesperzz (AT) hotmail (DOT) com> wrote

Quote:
It seems my code isn't removing the partition from the measure group. It
logs it as being successful, however the partition still remains.

Any ideas?

Thanks.




Dim oPartition As Partition

oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e)

objMeasureGroup.Partitions.Remove(oPartition)

objMeasureGroup.Update()





Reply With Quote
  #3  
Old   
Jesse O.
 
Posts: n/a

Default Re: AMO question - deleting partition - 04-12-2006 , 04:58 PM



That's an absolutely perfect description of the different methods.

Thanks Adrian!

"Adrian Dumitrascu [MS]" <adriandu (AT) microsoft (DOT) com> wrote

Quote:
In order to remove a major object (Partition included; other major object
examples: Dimension, DataSource, Cube, MiningStructure, MiningModel), you
need to call .Drop() method on that object.

oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e);
oPartition.Drop();


The .Drop method removes the object from the AMO structures and also from
the server.
The .Remove method only removes the object from the AMO collection, but
not from the server (like in the code
objMeasureGroup.Partitions.Remove(oPartition)).
The .Update() method saves the properties and minor collections of an
object (but does nothing for its major children), so in the code below,
the objMeasureGroup.Update() would not propagate the Partition removal
from AMO's structures to the server.
There is an overload for the .Update method (with ExpandFull option) that
fully saves an object to the server (so you can delete a major object with
.Remove and then a full Update on it parent, but this will be way too
costly compared to the .Drop method).

Adrian.



"Jesse O." <jesperzz (AT) hotmail (DOT) com> wrote in message
news:uk04Q9bXGHA.4144 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
It seems my code isn't removing the partition from the measure group. It
logs it as being successful, however the partition still remains.

Any ideas?

Thanks.




Dim oPartition As Partition

oPartition = objMeasureGroup.Partitions.GetByName(sPartitionNam e)

objMeasureGroup.Partitions.Remove(oPartition)

objMeasureGroup.Update()







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.