<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Mark Mrachek - Business Intelligence Blog</title>
    <link>http://www.mrachek.com/</link>
    <description />
    <language>en-us</language>
    <copyright>Mark Mrachek</copyright>
    <lastBuildDate>Sat, 14 Jan 2006 04:09:21 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.8.5223.2</generator>
    <managingEditor>webmaster@mrachek.com</managingEditor>
    <webMaster>webmaster@mrachek.com</webMaster>
    <item>
      <trackback:ping>http://www.mrachek.com/Trackback.aspx?guid=fe0eabbb-d539-4000-9413-9b5488c9fda1</trackback:ping>
      <pingback:server>http://www.mrachek.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.mrachek.com/PermaLink,guid,fe0eabbb-d539-4000-9413-9b5488c9fda1.aspx</pingback:target>
      <dc:creator>webmaster@mrachek.com (Mark Mrachek)</dc:creator>
      <wfw:comment>http://www.mrachek.com/CommentView,guid,fe0eabbb-d539-4000-9413-9b5488c9fda1.aspx</wfw:comment>
      <wfw:commentRss>http://www.mrachek.com/SyndicationService.asmx/GetEntryCommentsRss?guid=fe0eabbb-d539-4000-9413-9b5488c9fda1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Here is a bit of sample code for adding relationships between objects in
      Data Source Views in Analysis Services.
   </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> strConn <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"Provider=MSOLAP.3;Data
      Source=LOCAL;Initial Catalog=AS_DATABASE"</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> objServer <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> Server()<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> objDatabase <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> Database<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> objDSV <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DataSourceView<br /><br />
      objServer.Connect(strConn)<br />
      objDatabase <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> objServer.Databases.FindByName(<span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"AS_DATABASE_NAME"</span>)<br />
      objDSV <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> objDatabase.DataSourceViews.FindByName(<span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"DATA_SOURCE_VIEW_NAME"</span>)<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'Delete
      existing relationships in dsv</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> objDSV.Schema.Relations.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Count</span> &gt;
      0 <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
         objDSV.Schema.Relations.Clear()<br />
         objDSV.Update()<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'Create
      Relationships in DSV</span><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"></span>AddRelationship(objDSV, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_PKTable1"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"PKColumnName"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_FKTable1"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"FKColumnName"</span>)<br />
      AddRelationship(objDSV, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_PKTable2"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"PKColumnName"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_FKTable2"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"FKColumnName"</span>)<br />
      AddRelationship(objDSV, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_PKTable3"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"PKColumnName"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_FKTable3"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"FKColumnName"</span>)<br />
      AddRelationship(objDSV, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_PKTable4"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"PKColumnName"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"dbo_FKTable4"</span>, <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"FKColumnName"</span>)<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'Update
      DSV</span><br />
      objDSV.Update()<br /><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span> AddRelationship(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> objDSV <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DataSourceView, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> strPKTable <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> strPKCol <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> strFKTable <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> strFKCol <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   Dim</span> objPKCol <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> Data.DataColumn <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> objDSV.Schema.Tables(strPKTable).Columns(strPKCol)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   Dim</span> objFKCol <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> Data.DataColumn <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> objDSV.Schema.Tables(strFKTable).Columns(strFKCol)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   Dim</span> strFKName <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"FK_"</span> &amp;
      strFKTable &amp; <span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)">"_"</span> &amp;
      strFKCol<br /><br />
         objDSV.Schema.Relations.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Add</span>(strFKName,
      objPKCol, objFKCol, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">True</span>)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span></span>
        </p>
        <p>
      If you choose to use this sample code, please note that the underscore replaces the
      "." in the user.object naming standard used by SQL Server.  For instance, if
      your table owner is dbo and your table is called tbltable1, then the complete SQL
      Server name of the object would be dbo.tblTable1.  Analysis Services replaces
      the "." with and underscore.  The name that the table in the DSV would be dbo_tblTable1.
   </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.mrachek.com/aggbug.ashx?id=fe0eabbb-d539-4000-9413-9b5488c9fda1" />
      </body>
      <title>Programmatically Adding Relationships in Data Source Views</title>
      <guid>http://www.mrachek.com/PermaLink,guid,fe0eabbb-d539-4000-9413-9b5488c9fda1.aspx</guid>
      <link>http://www.mrachek.com/PermaLink,guid,fe0eabbb-d539-4000-9413-9b5488c9fda1.aspx</link>
      <pubDate>Sat, 14 Jan 2006 04:09:21 GMT</pubDate>
      <description>&lt;p&gt;
   Here is a bit of sample code&amp;nbsp;for adding&amp;nbsp;relationships between objects in
   Data Source Views in Analysis Services.
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Dim&lt;/span&gt; strConn &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;String&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"Provider=MSOLAP.3;Data
   Source=LOCAL;Initial Catalog=AS_DATABASE"&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Dim&lt;/span&gt; objServer &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;New&lt;/span&gt; Server()&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Dim&lt;/span&gt; objDatabase &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; Database&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Dim&lt;/span&gt; objDSV &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; DataSourceView&lt;br&gt;
   &lt;br&gt;
   objServer.Connect(strConn)&lt;br&gt;
   objDatabase &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; objServer.Databases.FindByName(&lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"AS_DATABASE_NAME"&lt;/span&gt;)&lt;br&gt;
   objDSV &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; objDatabase.DataSourceViews.FindByName(&lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"DATA_SOURCE_VIEW_NAME"&lt;/span&gt;)&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'Delete
   existing relationships in dsv&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;If&lt;/span&gt; objDSV.Schema.Relations.&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Count&lt;/span&gt; &amp;gt;
   0 &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Then&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;objDSV.Schema.Relations.Clear()&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;objDSV.Update()&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;End&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;If&lt;/span&gt;
   &lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'Create
   Relationships in DSV&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;/span&gt;AddRelationship(objDSV, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_PKTable1"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"PKColumnName"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_FKTable1"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"FKColumnName"&lt;/span&gt;)&lt;br&gt;
   AddRelationship(objDSV, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_PKTable2"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"PKColumnName"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_FKTable2"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"FKColumnName"&lt;/span&gt;)&lt;br&gt;
   AddRelationship(objDSV, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_PKTable3"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"PKColumnName"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_FKTable3"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"FKColumnName"&lt;/span&gt;)&lt;br&gt;
   AddRelationship(objDSV, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_PKTable4"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"PKColumnName"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"dbo_FKTable4"&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"FKColumnName"&lt;/span&gt;)&lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'Update
   DSV&lt;/span&gt;
   &lt;br&gt;
   objDSV.Update()&lt;br&gt;
   &lt;br&gt;
   &lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Sub&lt;/span&gt; AddRelationship(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;ByVal&lt;/span&gt; objDSV &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; DataSourceView, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;ByVal&lt;/span&gt; strPKTable &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;String&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;ByVal&lt;/span&gt; strPKCol &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;String&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;ByVal&lt;/span&gt; strFKTable &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;String&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;ByVal&lt;/span&gt; strFKCol &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;String&lt;/span&gt;)&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim&lt;/span&gt; objPKCol &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; Data.DataColumn &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; objDSV.Schema.Tables(strPKTable).Columns(strPKCol)&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim&lt;/span&gt; objFKCol &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; Data.DataColumn &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; objDSV.Schema.Tables(strFKTable).Columns(strFKCol)&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim&lt;/span&gt; strFKName &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;As&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;String&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"FK_"&lt;/span&gt; &amp;amp;
   strFKTable &amp;amp; &lt;span style="FONT-SIZE: 11px; COLOR: rgb(102,102,102); FONT-FAMILY: Courier New; BACKGROUND-COLOR: rgb(228,228,228)"&gt;"_"&lt;/span&gt; &amp;amp;
   strFKCol&lt;br&gt;
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;objDSV.Schema.Relations.&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Add&lt;/span&gt;(strFKName,
   objPKCol, objFKCol, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;True&lt;/span&gt;)&lt;br&gt;
   &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;End&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Sub&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   If you choose to use this sample code, please note that the underscore replaces the
   "." in the user.object naming standard used by SQL Server.&amp;nbsp; For instance, if
   your table owner is dbo and your table is called tbltable1, then the complete SQL
   Server name of the object would be dbo.tblTable1.&amp;nbsp; Analysis Services replaces
   the "." with and underscore.&amp;nbsp; The name that the table in the DSV would be dbo_tblTable1.
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.mrachek.com/aggbug.ashx?id=fe0eabbb-d539-4000-9413-9b5488c9fda1" /&gt;</description>
      <comments>http://www.mrachek.com/CommentView,guid,fe0eabbb-d539-4000-9413-9b5488c9fda1.aspx</comments>
      <category>Analysis Services/AMO</category>
    </item>
    <item>
      <trackback:ping>http://www.mrachek.com/Trackback.aspx?guid=fadb7f78-6bec-43fe-b9c0-ea4a1da59602</trackback:ping>
      <pingback:server>http://www.mrachek.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.mrachek.com/PermaLink,guid,fadb7f78-6bec-43fe-b9c0-ea4a1da59602.aspx</pingback:target>
      <dc:creator>webmaster@mrachek.com (Mark Mrachek)</dc:creator>
      <wfw:comment>http://www.mrachek.com/CommentView,guid,fadb7f78-6bec-43fe-b9c0-ea4a1da59602.aspx</wfw:comment>
      <wfw:commentRss>http://www.mrachek.com/SyndicationService.asmx/GetEntryCommentsRss?guid=fadb7f78-6bec-43fe-b9c0-ea4a1da59602</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
   Today I started working with Analysis Management Objects (AMO) which is a library
   of classes that users work with to create and manage Analysis Services objects. 
   Although DSO 9.0 (Decision Support Objects) is available in Analysis Services 2005,
   it is being deprecated and developers are encouraged to use AMO instead of DSO in
   the future.  So far, I've been highly impressed with AMO.  Hopefully I can
   get a few scripts out in the next week or so.<img width="0" height="0" src="http://www.mrachek.com/aggbug.ashx?id=fadb7f78-6bec-43fe-b9c0-ea4a1da59602" /></body>
      <title>Analysis Management Objects (AMO)</title>
      <guid>http://www.mrachek.com/PermaLink,guid,fadb7f78-6bec-43fe-b9c0-ea4a1da59602.aspx</guid>
      <link>http://www.mrachek.com/PermaLink,guid,fadb7f78-6bec-43fe-b9c0-ea4a1da59602.aspx</link>
      <pubDate>Wed, 04 Jan 2006 03:14:35 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
Today I started working with Analysis Management Objects (AMO) which is a library
of classes that users work with to create and manage Analysis Services objects.&amp;nbsp;
Although DSO 9.0 (Decision Support Objects) is available in Analysis Services 2005,
it is being deprecated and developers are encouraged to use AMO instead of DSO in
the future.&amp;nbsp; So far, I've been highly impressed with AMO.&amp;nbsp; Hopefully I can
get a few scripts out in the next week or so.&lt;img width="0" height="0" src="http://www.mrachek.com/aggbug.ashx?id=fadb7f78-6bec-43fe-b9c0-ea4a1da59602" /&gt;</description>
      <comments>http://www.mrachek.com/CommentView,guid,fadb7f78-6bec-43fe-b9c0-ea4a1da59602.aspx</comments>
      <category>Analysis Services/AMO</category>
    </item>
  </channel>
</rss>