Is it possible to create a OLAP database from code ?

  • Does anybody know if it is possible to create a Analysis Services database from T-SQL, ADOX, ADOMD or some other way than from Analysis Manager ?

    I'm able to create cubes, but can't find any documentation on creating the database.

     

    Thanks in advance,

    Thomas

  • Definitely.  Look in BOL in the index under DSO, subtopic of databases.  You'll find sample script like below...

     

    Private Sub CreateDatabase()    Dim dsoServer As New DSO.Server    Dim dsoDB As DSO.MDStore    Dim strDBName As String    Dim strDBDesc As String    ' Create a connection to the Analysis server.    dsoServer.Connect "LocalHost"    ' Initialize the string variables for the    ' new database name and description.    strDBName = "TestDB"    strDBDesc = "Test Database"    ' Is there already a database by this name?    If dsoServer.MDStores.Find(strDBName) Then        MsgBox strDBName & " already exists."        Exit Sub    End If    ' Add new database to server object collection.    ' Using the AddNew method from MDStores.    Set dsoDB = dsoServer.MDStores.AddNew(strDBName)    'Assign the description to the MDStore's    'Description property, and then call the Update method.    dsoDB.Description = strDBDesc    dsoDB.Update    'Inform the user that the database was added to the server.    MsgBox (strDBName & " added to server " & dsoServer.Name)End Sub

    Steve.

  • Thank you, just what I needed.

    Can't believe I didn't find it in BOL 🙂

     

    Thomas

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply