Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove database with AMO (Analysis Management Objects)?

Tags:

ssas

Can not find a way to remove database in AMO (Analysis Management Objects). This code does not work:

 if (svr.Databases.Contains(databaseName))
 {      
    svr.Databases.Remove(databaseName, true);
    svr.Update();
 }
 svr.Disconnect();

No error appears, but database still there. Same if I use Database object instead of database name. I was unable to find much about Databases.Remove method online.

like image 254
YMC Avatar asked Apr 23 '26 12:04

YMC


1 Answers

I think that calling Remove() only removes it from the in-memory collection and doesn't reflect anything on the server.

I think what you're looking for is the Drop() method. So what you would do is something like:

  1. Get the Database object by calling a method like GetByName()
  2. Once you have the Database object, call Drop() on it
like image 99
nkvu Avatar answered Apr 26 '26 10:04

nkvu