.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Processing orphan dimension records with NULL parent foreign keys

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :Sql Server
<head> <style type="text/css"> .style1 { font-family: Arial, Helvetica, sans-serif; } .style2 { font-family: Arial, Helvetica, sans-serif; font-size: x-small; margin-bottom: 0px; } .style3 { font-size: x-small; } .style4 { font-family: Arial, Helvetica, sans-serif; font-size: x-small; margin-bottom: 0; } .style5 { color: #0000FF; } .style6 { font-family: "Courier New", Courier, monospace; } .style7 { color: #0066CC; font-weight: bold; font-style: italic; } </style> </head>

This link Handling Data Integrity Issues in Analysis Services 2005 is a classic paper on handling data integrity. The snowflaked data structure decribed in it is:

Product Class (dimension)  <--  Product (dimension)  <--  Sales (fact) where some Products do not have a Product Class

My situation is similar, but a bit more complex.   I don't actually have referential integrity problems . . . orphans are valid.

I have two fact tables TableA and TableB. They are related in a [0-or-1] to a [0-or-many] structure.

  • That is, each TableA record may have zero, one, or many TableB records associated with

    View Complete Post

More Related Resource Links

Denormalising dimension tables with multiple foreign keys


In SSAS 2008 I am trying to "denormalise" 2 source dimension tables into a single dimension.   The main table has 2 FKs to the other  parent table which I am trying to merge in.   What I have done so far is to make 2 copies of the parent table attributes in the dimension and name them accordingly.   Then I set the attribute relationships to link each FK column to the appropriate set of parent columns.   i.e. ending up with something like this:

DIM KEY -> DIM FK1 -> FK1 parent columns

             -> DIM FK2 -> FK2 parent columns

I thought that would be enough for SSAS to realise that FK1 parent columns come via the table relationship involving FK1 and FK2 parent columns come via the table relationship involving FK2.

I was wrong!   When I look at the SQL generated when processing the dimension it seems to choose one of the FKs and uses the same FK when joining both times to the parent table.   i.e. something like:

SELECT DIM.FK1, parent.parent columns from DIM, parent where DIM.FK2 = parent.KEY

Is it possible to do what I am trying??

Microsoft JScript runtime error: 'Parent' is null or not an object


Hi friends,

        I got This Error : Microsoft JScript runtime error: 'Parent' is null or not an object

 In runtime,after  click on the check box, It Show "Microsoft JScript runtime error: 'Parent' is null or not an object"

<script language ="javascript" type ="text/javascript" >
        function SelectAllCheckboxesSpecific(spanChk)
           var IsChecked = spanChk.checked;
           var items=0;
           var Chk = spanChk;
              Parent = document.getElementById('gvUsers');          
              var items = Parent.getElementsByTagName('input');                         
              for(var i=0;i<items.length;i++)
                  if(items[i].id != Chk && items[i].type=="checkbox")
                      if(items[i].checked!= IsChecked)

please verify it. 

MDX Query - Get (Parent-Child) Dimension member regarding another Parent-Child Dimension, then, get

Hi there, I got the following MDX issue. My cube structure looks like that : DIMENSION CATEGORY (Parent-Child) --> (Many to many) FCTLESS_CategoryNode <-- DIMENSION NODE (Parent-Child) ___ DIMENSION NODE (Parent-Child) --> (Many to many) FCTLESS_NodeVariable <-- DIMENSION VARIABLE ___ DIMENSION VARIABLE <-- FACT (Supposed with only one value called VALUE) I'd like aggregate for N nodes linked to a specific category. For example, with the next content : DIMENSION CATEGORY - COUNTRY - SITE - BUILDING DIMENSION NODE US (Category Country)     - Site US_A (Category Site)     - Building US_A_A  (Category Building) FR (Category Country)     - Site FR_A (Category Site)     - Building FR_A_A  (Category Building)                                       - Site FR_A (Category Site)     - Building FR_A_B  (Category Building)                                       - Site FR_B (Category Site) 

Parent-Child relationship on a Type 2 (SCD) Dimension

For a Type 2 slowly changing dimension (SCD) such as Employee with a Parent-Child relationship, how do you handle the explosion of new rows when a high ranking employee has an attribute change?   It will require terminating the high ranking employee row and adding a new current row with a new surrogate key. Then every employee row below this employee will also have to be terminated and a new current row added with the new surrogate key of the parent.   This will have to be performed 1 level at a time so the subordinate rows will have the new surrogate key of their immediate parent.   For a large organization such as 20,000 employees, this will result in a dimension with hundreds of thousands rows in a relatively short time.   Is there a better way to model this?

SSAS - How to get other members from dimension that has Parent Child hierarchy?

I have a Sales Territory dimension that has employee and parent employee attribute on which parent child hierarchy is defined and it gives below hierarchy while browsing - - Mark Rolls --- Lumin Jacs ----- Larry Gomes ------- Messica Owens ------- Tom Ted ----------- Jackson Lopez ----- Matthew Ron --- Fred jacob - Jason Ron --- Jecy Pedro   But beside this parent-child hierarchy I have other attributes like employee address, email and telephone. My facts related sales transaction is tagged to lowest level. For example here facts are available only for Jackson Lopez (being Field Executive). When use below query I get complete sales reporting hierarchy result with some measures like sales amount, sales volume. But while accesing other attributes like address or email, it's repeating address/email/telephone of jackson Lopes everywhere to whom fact record is linked, Actually I want address/email/telephone of each sales employee from that dimension within hierarchy. How do I get it? The query I used is: Here Parent Terr ID is parent child hierachy. SELECT ( Descendants( { [Dim SalesRegion].[Parent Terr ID].[Employee Level 01].&[538018] /* here Mark Rolls is 538018 */ }, 0,AFTER), NONEMPTY([Dim SalesRegion].[Emp Address].[Emp Address].Members), NONEMPTY([Dim SalesRegion].[Emp Email].[Emp Email].Members) ) ON ROWS , { ([Dim Date].[The Year].[The Year].[CY-2010], [Dim

Listing Foreign Keys

If I run the following code (quote many times on the internet), which should show all foreign keys in a database, but it only returns a partial list:   select CCU.table_name src_table, CCU.constraint_name src_constraint, CCU.column_name src_col, KCU.table_name target_table, KCU.column_name target_col, RC.UPDATE_RULE, RC.DELETE_RULE from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE CCU, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC, INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU where CCU.constraint_name = RC.constraint_name and RC.UNIQUE_CONSTRAINT_NAME = KCU.CONSTRAINT_NAME order by CCU.table_name, CCU.constraint_name   If I run the following, removing the KEY_COLUMN_USAGE link, it returns the full list:   select CCU.table_name src_table, CCU.constraint_name src_constraint, CCU.column_name src_col, RC.UNIQUE_CONSTRAINT_NAME, RC.CONSTRAINT_NAME, RC.UPDATE_RULE, RC.DELETE_RULE from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE CCU, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC where CCU.constraint_name = RC.constraint_name order by CCU.table_name, CCU.constraint_name   I can't figure out what the problem is, the ones that are being left out of the first query ad the ones where the unique_constraint is set to the column name, not the constraint's name. For example, the first one appears in both query results, the second one only appears in the secod queries results:   src_table src_constr

Non parent-child dimension with fact data at different levels... How!

Hi all, Quite new to SSAS, wondering if anyone could help with the following... I've got a dimension with attributes that indicate geographical location based upon UK postal boundaries - so ~1.8m Postcodes > ~10000 Postcode Sectors (PCDS) > ~3000 Postcode Districts (PCD) > ~100 Postcode Areas (PCA). The problem I have is that the address information is not of the highest quality. I have matched 50% of my facts to postcodes, of the remaining 50% i've mapped them to PCDS, PCD or PCA, where possible, leaving the lower-levels as NULL in those cases. My attribute hierarchy works fine where I have complete records all the way down the hierarchy, but I only have a single UNKNOWN member at the top (GOR) level. I want an UNKNOWN member at each level. It makes sense to me how to do this using a Parent-Child dimension, but i'm keen to avoid that as the performance is terrible. I'm hoping there's a method of configuring this. Any help massively appreciated.

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign

Using Visual Studio with MySQL.In my XSD dataset I created a query. It runs perfect. I can preview the data fine.In my BLL I wrote code (see below) to retrieve the query results and I'm getting...Using db As New dsDemoTableAdapters.DemoTableAdapter Dim dt As New DataTable dt = db.GetDemo(DemoId) ' ERROR HAPPENS HEREFailed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.Why would previewing the data work but in code it fails?Any ideas?

ContentPresenter.Content.Parent is null when set in a converter

Hey All,   We have a ContentPresenter who's Content property is bound to a Converter and set dynamically. We're noticing that at runtime, the UserControl of which is the Content property of the previously mentioned ContentPresenter, has its Parent property set to null.   The parent is obviously the ContentPresenter, but the Parent property is null in this case. This seems to be occurring when the Content property is bound in XAML with a Converter to find the View to bind to.

No Aggregation with parent-child dimension



I am trying to build a very simple datacube without dynamic aggregations. I only have one fact table and one dimension table. The dimension is a parent child dimension. In the fact table I have a value for each leaf or non-leaf from the dimension (except of one where I wanted to test if it shows null then). I first built the dimension which worked fine and then the cube with the only one measure with "aggregate function" = None. But when I processed the cube and went into the Browser tab and used the dimension I was not able to the see the hierarchy. It only says "Level 2" and "Grand total" and when I double click it I get an error message "Cannot drill into a total member". I went through some posts here where it was said that the dimension cannot have "MemberWithData" = NonLeafDataHidden which I had, so I changed it to visible. I also read that there cannot be a "Calculate" calculation when using no aggretion so I deleted that. Nothing changed the fact that I did not have the hierarchy in the dimension and didnt see any values from my fact table.

I think I need to something with the Calculation but i dont know what. I would be much appreciated if you could help me.

Thanks for your help,


Parent child dimension

I have simple Employee table like this:
EmployeeID char(11), not null
Name Char (50)
SupervisorID char(11), not null

I setup parent-child releationship with SupervisorID as foreign key and employeeID as primarykey, then run Dimension wizard, pick SupervisorID as Parent attribute. However when I process the dimension, I keep getting process fail error:

"Errors in the OLAP storage engine: A loop involving the member with the key 000013744, was detected in the parent-child relationship between the 'Employee' attribute and the 'Parent ID' attribute."

Any advice?



SSAS - Use simultaneously unary operator and custom member formula in a PC (Parent-Child) dimension


Hi all

I was wondering (even this might a very bad idea from a logical and performance perspective) if it is possible to use unary operator and custom member formula simultaneously? Until now I have used unary operator but now some new calculation can't be expressed using unary operator. The idea is just to add the new members calculation to custom member formulas. Is it possible to make cohabitate both. If I had to switch all unary operators to customer member formulas what would be the equivalent expression for +, - , ~?

thanks for your answer


Scripting Foreign Keys in SMO


I am scripting out our database using SMO.

Our database is contained in a schema. When I script out the foreign keys, the resulting script is missing the schema-qualifier on the REFERENCES clause.

My code looks like:


. FileName = strFilePath ;
. AppendToFile = true ;
. DriForeignKeys = true ;
. SchemaQualify = true ;
. SchemaQualifyForeignKeysReferences = true ;

dimension's incremental process generates processing on all partitions in cube


Hey eb

Have any one noticed this behavior??

Incremental process (process update) of dimension generates reprocessing of indexes on all cube's partitions,even when no change has occured in that dimension.

I am using SSAS 2005 sp2.

This is disturbing because my cube holds some 700 daily partitions so processing indexes on all of them - on an hourly basis - is very time consuming.

Also it flashes that cube's cache!


I did noticed that changing heirarchies memberskeysunique property to True + changing the toppest attribute in this heirarchy mambernamesunique to true solves this problem.

Is this a must then to prevent recalculating indexes on partitions every process update of dimension??



Excel Export Report with Parent Child Dimension OLAP





I have a problem with a reporting services 2005 report.

The data source is OLEDB for OLAP 9.

The report contains all the members of a parent child dimension. An example of the implementation is defined in the post following the forum msdn:

The report works fine in web. The problem is when the report is exported as Excel, the groups disappeared and the entire dimension is ragged down.

Normally toggled groups in reporting services are exported to Excel with the appearance '+' or '-' on the

Foreign & Primary Keys


I have the following FK on Items table

ALTER TABLE [dbo].[items]  WITH NOCHECK ADD  CONSTRAINT [FK_items_i_tmpnam] FOREIGN KEY([i_tmpnm_id])

REFERENCES [dbo].[i_tmpnam] ([tmpnam_id])



Yet I'm able to delete all records from i_tmpnam and leave orphans in the FK field in the Items table. So, does NOCHECK disables the constraint completely?


Premature optimization is the root of all evil in programming. (c) by Donald Knuth

Naomi Nosonovsky, Sr. Programmer-Analyst

My blog
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend