INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Extracting the DataSource Property from DataTable in DSV

Extracting the DataSource Property from DataTable in DSV

(OP)
Hi, this is my first time here....

I have a written a small function in a SSIS Script task objet in order to extract some infomation about Cube that are on my server...
I am almost done but I cannot extract the datasource from each table in a DSV starting from the cude. Some table in the same DSV comes from different DataSources.

Dim oServer As Microsoft.AnalysisServices.Server
oServer = New Microsoft.AnalysisServices.Server()
oServer.Connect("***")

For Each oDB As Microsoft.AnalysisServices.Database In oServer.Databases
For Each oCube As Microsoft.AnalysisServices.Cube In oDB.Cubes
For Each oTBL As DataTable In oCube.DataSourceView.Schema.Tables.
Sortie0Buffer.AddRow()
Sortie0Buffer.SSASDatabaseName = oDB.Name
Sortie0Buffer.CubeName = oCube.Name
Sortie0Buffer.TableName = oTBL.TableName
Sortie0Buffer.TableSource = oTBL.DataSet.DataSetName
Sortie0Buffer.DataSource = ???
Sortie0Buffer.TableType = oTBL.ExtendedProperties("TableType")
Next
Next
Next
oServer.Disconnect()

Can someone help me ?

RE: Extracting the DataSource Property from DataTable in DSV

I recommend you think outside the box, or cube in this case.....

You can have separate queries and join them via UNION or join the result sets using unix shell or powershell.

Just an idea. HTH.

====================================
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright

RE: Extracting the DataSource Property from DataTable in DSV

(OP)
Thanks for your response.

Finally I had my solution. Not sure it's very clean but it work's fine for me. If someone have cleaner code it would be nice for the community.

Here is what i did :

Dim oServer As Microsoft.AnalysisServices.Server
Dim DataSourceName As String
Dim cs As String
Dim Str1 As String

oServer = New Microsoft.AnalysisServices.Server()
oServer.Connect("****MyServerName****")

For Each oDB As Microsoft.AnalysisServices.Database In oServer.Databases
For Each oCube As Microsoft.AnalysisServices.Cube In oDB.Cubes
For Each oTBL As DataTable In oCube.DataSourceView.Schema.Tables
Sortie0Buffer.AddRow()
Sortie0Buffer.DatabaseName = oDB.Name
Sortie0Buffer.CubeName = oCube.Name
Sortie0Buffer.TableName = oTBL.TableName
Sortie0Buffer.TableSource = oTBL.DataSet.DataSetName

If Not String.IsNullOrEmpty(oTBL.ExtendedProperties("DataSourceID")) Then
DataSourceName = oTBL.ExtendedProperties("DataSourceID")
Else
DataSourceName = oCube.DataSourceView.DataSource.Name
End If

Sortie0Buffer.DataSource = DataSourceName

Sortie0Buffer.QueryDefinition = oTBL.ExtendedProperties("QueryDefinition")

If Not String.IsNullOrEmpty(oTBL.ExtendedProperties("QueryDefinition")) Then
Sortie0Buffer.TableType = "NamedQuery"
Else
Sortie0Buffer.TableType = oTBL.ExtendedProperties("TableType")
End If

cs = oDB.DataSources.FindByName(DataSourceName).ConnectionString

Str1 = cs.Substring(cs.IndexOf("Data Source=") + 12, 20)
Sortie0Buffer.DataSourceServer = Str1.Substring(0, Str1.IndexOf(";"))
Next
Next
Next
oServer.Disconnect()

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close