Processing an OLAP cube with a T-SQL Stored Procedure
create procedure ProcessCube
@Database varchar(100),
@Cube varchar(100),
@Partition varchar(100) = null, -- If NULL, process the entire Cube
@Server varchar(100) = 'localhost'
as
/*
Author: Jeff Smith
Version: 10/27/2008
*/
/* variables used to store object handles */
declare @o_svr int, @o_db int, @o_cube int, @o_part int, @o_mds int
declare @hr int
/* different cube processing options. This SP uses "default" */
declare @PROCESS_DEFAULT int
declare @PROCESS_FULL int
declare @PROCESS_REFRESH_DATA int
set @PROCESS_DEFAULT = 0
set @PROCESS_FULL = 1
set @PROCESS_REFRESH_DATA = 2
-- create a DSO.Server object:
exec @hr = sp_OACreate 'DSO.Server', @o_svr out
if @hr <> 0
begin
print 'Error at create server:'
exec sp_OAGetErrorInfo @o_svr
goto cleanup
end
-- Connect to the server:
exec @hr = sp_OAMethod @o_svr, 'Connect', null, @Server
if @hr <> 0
begin
print 'Error at connect to server:'
exec sp_OAGetErrorInfo @o_svr
goto cleanup
end
-- Get the MDStores property from the Server:
exec @hr = sp_OAGetProperty @o_svr,'MDStores', @o_mds OUT
if @hr <> 0
begin
print 'Error at get getting Server MDStores:'
exec sp_OAGetErrorInfo @o_svr
goto cleanup
end
-- Get the database from the MDStores:
exec @hr = sp_OAGetProperty @o_mds,'Item',@o_db OUT,@Database
if @hr <> 0
begin
print 'Error at get database:'
exec sp_OAGetErrorInfo @o_mds
goto cleanup
end
-- get the MDStores property from the database:
exec sp_OADestroy @o_mds
exec @hr = sp_OAGetProperty @o_db,'MDStores', @o_mds OUT
if @hr <> 0
begin
print 'Error at get database MDStores:'
exec sp_OAGetErrorInfo @o_db
goto cleanup
end
-- get the Cube from the MDStores
exec @hr = sp_OAGetProperty @o_mds,'Item',@o_cube OUT, @Cube
if @hr <> 0
begin
print 'Error at get Cube:'
exec sp_OAGetErrorInfo @o_mds
goto cleanup
end
if @Partition is null -- Process the entire Cube, not just a single partition
begin
exec @hr = sp_OAMethod @o_cube, 'Process', null, @PROCESS_DEFAULT
if @hr <> 0
begin
print 'Error at process Cube:'
exec sp_OAGetErrorInfo @o_cube
goto cleanup
end
end
else -- just process the specified Partition
begin
-- Get the MDStores property of the Cube:
exec sp_OADestroy @o_mds
exec @hr = sp_OAGetProperty @o_cube,'MDStores', @o_mds OUT
if @hr <> 0
begin
print 'Error at get Cube MDStores:'
exec sp_OAGetErrorInfo @o_cube
goto cleanup
end
-- Get the partition to process:
exec @hr = sp_OAGetProperty @o_mds,'Item',@o_part OUT, @Partition
if @hr <> 0
begin
print 'Error at get Parition:'
exec sp_OAGetErrorInfo @o_mds
goto cleanup
end
-- Process the partition:
exec @hr = sp_OAMethod @o_part, 'Process', null, @PROCESS_DEFAULT
if @hr <> 0
begin
print 'Error at process Partition:'
exec sp_OAGetErrorInfo @o_part
goto cleanup
end
end
-- And unlock all objects on the server:
exec @hr = sp_OAMethod @o_svr, 'UnlockAllObjects'
if @hr <> 0
begin
print 'Error at unlock all server objects:'
exec sp_OAGetErrorInfo @o_svr
goto cleanup
end
cleanup:
if @o_mds is not null exec sp_OADestroy @o_mds
if @o_Part is not null exec sp_OADestroy @o_Part
if @o_cube is not null exec sp_OADestroy @o_cube
if @o_db is not null exec sp_OADestroy @o_db
if @o_svr is not null exec sp_OADestroy @o_svr
Buy:Cialis.Viagra Super Active+.Levitra.Tramadol.Viagra Super Force.Viagra Soft Tabs.Maxaman.Propecia.Viagra Professional.Cialis Soft Tabs.VPXL.Cialis Super Active+.Super Active ED Pack.Soma.Cialis Professional.Zithromax.Viagra….
Buy:Cozaar.Buspar.Acomplia.Zocor.Ventolin.Prozac.Wellbutrin SR.Lipitor.SleepWell.Nymphomax.Aricept.Advair.Zetia.Benicar.Amoxicillin.Female Cialis.Seroquel.Female Pink Viagra.Lipothin.Lasix….
unit http://lheatingb-j.02JEEPPARTS.US/tag/conditioner+heater+window+unit+air+and/ : and…
and…
Buy:Buspar.Amoxicillin.Benicar.Zocor.Female Cialis.SleepWell.Lasix.Ventolin.Zetia.Nymphomax.Cozaar.Seroquel.Lipothin.Wellbutrin SR.Aricept.Acomplia.Female Pink Viagra.Lipitor.Advair.Prozac….
mpg http://ygw.rix.zba.vg : mpg…
cars…
████████►BUY VIAGRA◀███████…
████████▲▲▲▲▲▲▲▲▲████████…
order cialis in canada online…
Buyno prescription…
avodart@in.usa” rel=”nofollow”>.…
Buyno prescription…
generic@Cialis.now” rel=”nofollow”>.…
Buynow…
dicyclomine@and.imodium” rel=”nofollow”>……
Buygeneric drugs…
depakote@classification.now” rel=”nofollow”>..…
Buygeneric drugs…
e-code for zometa…
Buyit now…
cats zanaflex…
Buydrugs without prescription…
Zaditor…
Buydrugs without prescription…
Zyrtec…
Buyit now…
zyprexa relprevv j-code…
Buygeneric drugs…
Zyprexa…
Buynow it…
Prozac…
Buygeneric meds…
Tylenol@Tylenol.Tylenol” rel=”nofollow”>……
Buygeneric meds…
Topamax@Topamax.Topamax” rel=”nofollow”>.…
Buyit now…
Slimfast@Slimfast.Slimfast” rel=”nofollow”>……
Buynow…
Cozaar@Cozaar.Cozaar” rel=”nofollow”>.…
Buynow it…
.…
Buynow…
rhinocort@vs.beconase” rel=”nofollow”>.…
Buyno prescription…
can@cymbalta.cause.vaginal.itching.and.irritation” rel=”nofollow”>..…
Buydrugs without prescription…
advair@side.effects” rel=”nofollow”>.…
Buyit now…
.…
Buyno prescription…
long@term.prilosec.use” rel=”nofollow”>.…
Buygeneric drugs…
abilify@and.olanzapine” rel=”nofollow”>.…
Buyit now…
side@effects.of.dog.medication.famotidine.and.flagyl” rel=”nofollow”>……
Buygeneric drugs…
pediatric@dosage.of.prednisolone” rel=”nofollow”>……
Buyno prescription…
……
Buygeneric drugs…
buy@generic.VIAGRA” rel=”nofollow”>……
Need cheap generic VIAGRA?…
Get@Coral.Calcium.Online” rel=”nofollow”>..…
Buygeneric drugs…
Order@Abana.Online” rel=”nofollow”>……
Buywithout prescription…
Buy@Discount.Abilify” rel=”nofollow”>……
Buywithout prescription…
Order@Abilify.Online” rel=”nofollow”>.…
Buynow it…
Purchase@Discount.Abilify” rel=”nofollow”>..…
Buyit now…
pictures@of.abilify” rel=”nofollow”>..…
Buyno prescription…
Order@Abilify.Without.Prescription” rel=”nofollow”>..…
Buynow it…
Buy@Cheap.Acai” rel=”nofollow”>..…
Buydrugs without prescription…
Buy@Discount.Acai” rel=”nofollow”>..…
Buynow it…
Order@Discount.Acai” rel=”nofollow”>……
Buywithout prescription…
Buy@Generic.Acai.Without.Prescription” rel=”nofollow”>……
Buygeneric drugs…
Cheap@Acai.Without.Prescription” rel=”nofollow”>..…
Buygeneric meds…
Buy@Discount.Coral.Calcium” rel=”nofollow”>.…
Buygeneric meds…
Buy@Discount.Abilify” rel=”nofollow”>..…
Buygeneric pills…
Buy@Acai.Online” rel=”nofollow”>.…
Buywithout prescription…
Buy@Discount.Acai” rel=”nofollow”>……
Buynow…
Order@Cheap.Acai” rel=”nofollow”>……
Buyit now…
Purchase@Acai.Online” rel=”nofollow”>……
Buynow it…
Purchase@Cheap.Acai” rel=”nofollow”>……
Buyit now…
Purchase@Cheap.Acai” rel=”nofollow”>..…
Buywithout prescription…
Order@Generic.Acai” rel=”nofollow”>..…
Buydrugs without prescription…
Generic@Acai.500mg.Without.Prescription” rel=”nofollow”>.…
Buyno prescription…
Buy@Cheap.Energy.Boost” rel=”nofollow”>.…
Buygeneric drugs…
Buy@Accupril.Online” rel=”nofollow”>.…
Buygeneric meds…
Purchase@Accutane.Online” rel=”nofollow”>.…
Buynow it…
Purchase@Accutane.Without.Prescription” rel=”nofollow”>.…
Buygeneric drugs…
Cheap@Generic.Accutane.10mg.20mg” rel=”nofollow”>.…
Buyno prescription…
Cheap@Aciphex.Online” rel=”nofollow”>.…
Buynow it…
Buy@Aciphex.20mg” rel=”nofollow”>.…
Buygeneric drugs…
Buy@Generic.Aciphex.20mg” rel=”nofollow”>.…
Buynow it…
Cheap@Generic.Aciphex.20mg” rel=”nofollow”>.…
Buygeneric drugs…
Order@Acomplia.Online” rel=”nofollow”>.…
Buygeneric meds…
Order@Discount.Acomplia” rel=”nofollow”>.…
Buygeneric drugs…
Buy@Actonel.35mg” rel=”nofollow”>..…
Buygeneric drugs lzt…
Buy@Actos.Online” rel=”nofollow”>.…
Buygeneric drugs zfk…
Purchase@Actos.Online” rel=”nofollow”>..…
Buygeneric meds qmo…
Purchase@Cheap.Actos” rel=”nofollow”>..…
Buynow it vhx…
Buy@Generic.Actos” rel=”nofollow”>..…
Buygeneric drugs eet…
Buy@Generic.Actos.Without.Prescription” rel=”nofollow”>..…
Buygeneric drugs krg…
Order@Adalat.Online” rel=”nofollow”>..…
Buygeneric meds qhr…
Purchase@Coral.Calcium.Online” rel=”nofollow”>.…
Buyno prescription luw…
Buy@Abana.Online” rel=”nofollow”>..…
Buynow it tly…
Cheap@Generic.Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>.…
Buywithout prescription yyn…
Buy@Acai.Online” rel=”nofollow”>……
Buydrugs without prescription vrg…
Get@Acai.Online” rel=”nofollow”>……
Buynow it zdg…
Purchase@Generic.Acai” rel=”nofollow”>..…
Buydrugs without prescription faj…
Order@Energy.Boost.Online” rel=”nofollow”>.…
Buygeneric drugs axm…
Cheap@Energy.Boost.Online” rel=”nofollow”>……
Buydrugs without prescription jlg…
Get@Energy.Boost.Online” rel=”nofollow”>..…
Buyno prescription jui…
Get@Aciphex.Online” rel=”nofollow”>.…
Buygeneric drugs nih…
Purchase@Generic.Aciphex” rel=”nofollow”>..…
Buydrugs without prescription ygy…
Purchase@Aciphex.Without.Prescription” rel=”nofollow”>.…
Buydrugs without prescription xab…
Cheap@Aciphex.20mg” rel=”nofollow”>.…
Buyit now ojb…
Buy@Aciphex.20mg” rel=”nofollow”>.…
Buygeneric drugs mby…
Purchase@Generic.Aciphex.20mg” rel=”nofollow”>……
Buywithout prescription ccw…
Order@Actonel.Online” rel=”nofollow”>……
Buynow fjl…
Order@Cheap.Advair” rel=”nofollow”>……
Buygeneric drugs vbr…
Purchase@Cheap.Advair” rel=”nofollow”>.…
Buygeneric pills oir…
Get@Advair.Online” rel=”nofollow”>.…
Buygeneric drugs hwi…
Buy@Generic.Advair.Without.Prescription” rel=”nofollow”>..…
Buyno prescription jwi…
Order@Generic.Advair” rel=”nofollow”>..…
Buydrugs without prescription hak…
Buy@Discount.Aggrenox” rel=”nofollow”>..…
Buyno prescription wkp…
Order@Discount.Aggrenox” rel=”nofollow”>..…
Buyno prescription lka…
Purchase@Albenza.Online” rel=”nofollow”>……
Buydrugs without prescription ttp…
coral@calcium.vitamin.explanation” rel=”nofollow”>.…
Buywithout prescription…
aleve@cold.tablets” rel=”nofollow”>……
Buygeneric pills…
aloe@vera.juice.benefits.best” rel=”nofollow”>.…
Buygeneric meds…
arava@adverse.events” rel=”nofollow”>……
Buygeneric meds…
coral@calcium.supplements” rel=”nofollow”>……
Buygeneric meds…
aciphex@muscle.pain” rel=”nofollow”>..…
Buygeneric pills…
actos@side.effects.edema” rel=”nofollow”>..…
Buygeneric drugs…
how@to.monitor.anafranil” rel=”nofollow”>.…
Buyno prescription…
hiv research being conducted in usa…
Buy_generic pills…
stage 3 ovarian cancer…
Buy_drugs without prescription…
alberta alcohol and drug abuse commission…
Buy_generic meds…
the process of methanogens metabolism…
Buy_drugs without prescription…
advair and contraindications…
Buy_generic meds…
canine heat cycles…
Buy_without prescription…
apo amitriptyline…
Buy_generic pills…
recipes for gastric bypass patients…
Buy_now…
citalopram length of use…
Buy_drugs without prescription…
conquer online hacking tools…
Buy_generic drugs…
symptoms of prescription drug abuse…
Buy_drugs without prescription…
weight gain stories feeders…
Buy_drugs without prescription…
ept pregnancy test…
Buy_generic meds…
accutane birth defects…
Buy_it now…
menstrual patterns in menopause…
Buy_no prescription…
market drugs edmonton…
Buy_now it…
dependent disorder anxiety…
Buy_generic pills…
adrenal cancer symptoms…
Buy_generic drugs…
indigestion and chest pain…
Buy_now it…
herbal flee collars for dogs…
Buy_generic pills…
working and twin pregnancy…
Buy_now it…
how to embed pictures ms office…
Buy_drugs without prescription…
youtube monavie cancer…
Buy_generic meds…
adult survivors of childhood cancer…
Buy_generic pills…
singapore secure psychiatric forensic unit…
Buy_no prescription…
mini insulin fridge…
Buy_generic drugs…
decongestants hypertension safe…
Buy_now it…
high calorie diet for babies…
Buy_generic drugs…
cheap fetal heart rate monitor…
Buy_generic meds…
cures for fingernail fungi…
Buy_generic meds…
avelox treats for bacteria…
Buy_drugs without prescription…
drug treatment for bipolar disorder…
Buy_generic pills…
canine kidney failure symptoms…
Buy_generic pills…
bacterial staphylococcus aureus meningitis symptoms…
Buy_without prescription…
st joseph aspirin coupon…
Buy_generic pills…
insulin receptor inhibition…
Buy_without prescription…
sample tlc diets…
Buy_generic drugs…
hot spots or cancer…
Buy_without prescription…
cancer chemotherapy combination drugs…
Buy_generic meds…
build muscle mass diet…
Buy_drugs without prescription…
south beach diet foods to avoid…
Buy_no prescription…
rebound phenomenon during gradual clonidine withdrawal…
Buy_drugs without prescription…
kids weight gain…
Buy_generic drugs…
100 mile diet store…
Buy_generic meds…
list of anti anxiety drugs…
Buy_generic meds…
pain relief until root canal…
Buy_generic meds…
free diabetes logbooks to print…
Buy_generic drugs…
altitude and pregnancy…
Buy_it now…
glucophage powered by vbulletin version 2.2.1…
Buy_generic pills…
hiv quality of life survey tools…
Buy_drugs without prescription…
obesity in moorhead minnesota…
Buy_now…
interactions with azithromycin and astragalus…
Buy_it now…
medical nebulizer…
Buy_generic meds…
dog retching vomiting weight loss…
Buy_generic drugs…
kim kardashian weight gain…
Buy_now…
breast cancer site is having trouble…
Buy_drugs without prescription…
space herpes…
Buy_now…
boost metabolism foods…
Buy_now…
drug citalopram side effects…
Buy_generic drugs…
remeron dreams…
Buy_it now…
fruity taste and diabetes…
Buy_it now…
Download@alternative.Rock” rel=”nofollow”>.…
Search rock UK Charts…