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

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

Many Parents Many Children relationship

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :Sql Server

OLAP - I have in RDBMS(Data Warehouse) -  ParentId and ChildId are TypeId's

ParentId and ChildId have many to many relationship. One parent can have many children(TypeIds) and same way One ChildId can have multiple parents(TypeIds)

Table A
TypeId (PK)

Table B

TypeId (FK)

How will I design a OLAP solution for these tables - what are my dimension and its hierarchy?

I want to display for All Parents->All Children->Measure(Values), DateTime


View Complete Post

More Related Resource Links

hierarchyid - any thoughts on grouping children across multiple parents


Hey there,

I have just been playing around with the hierarchyid examples on MSDN and came across this issue in my experiments and wondered whether anyone has any thoughts on creating some sort of "grouping" of child nodes across different parents:

If I have the following two tree items:



The two DVD nodes aren't associated by anything other than a common title which makes it difficult to search for all DVDs so you could change the structure to this:


but then the problem rears it's ugly head in the same fashion when you add more data:


Now there are two Music and Movie nodes that are loosely associated by a common title.


I am not suggesting that the hierarchyid should be able to represent data like this and it is still useful for strictly hierarchical models I just wondered whether anyone had come up with a solution that overcomes this problem. My initial thoughts are that you could

An Entity Relationship Diagram Example

An Entity Relationship Diagram conveys a lot of information with a very concise notation. The important part to keep in mind is to limit what you're reading using the following technique:

Choose two entities (e.g. Company and Employee)
Pick one that you're interested in (e.g. how a single Company relates to employees)
Read the notation on the second entity (e.g. the crow's feet with the O above it next to the Employee entity).

Good way to do a Many-to-Many relationship?


I've used the automatic  Many-to-Many generation as described here: http://msdn.microsoft.com/en-us/library/dd742359.aspx

But that doesn't seem to allow a quantity to be attached to orders (in the example it would be courses). I have many customers and many products, I would like a customer to be able to order more than one product. Right now I get a grid of checkboxes. I would like instead a field where I could enter a number. 

Is this possible?

Command Management: Use Design Patterns to Simplify the Relationship Between Menus and Form Elements


In Windows Forms applications, similar commands, such as those in a menu and their counterparts on a toolbar, are not automatically related. They don't fire the same event or run the same handler routine. Yet code that allows the same or similar user commands to fire the same code simplifies development.This article describes the principles of command management and why it's important to have functional commands that are not exclusive to any one UI element. In order to provide an MFC-like command management infrastructure, a design pattern is developed and applied as a series of C# classes.

Michael Foster and Gilberto Araya

MSDN Magazine October 2002

Treeview: Select all children if Parent is selected etc...



I'm using a Treeview with  ShowCheckBoxes="All" , so basically I have a tree with all CheckBox Nodes. I'm using the TreeView inside an update panel, and populate the Tree code behind dynamically.

My requrements are the following:

1) Select all the children if parent is selected,

2) When parent is selected, and if we de-select a child, set parent unselected

3) Track if new nodes were selected and previously selected nodes were de-selected (becasue I need to update the database according to the selections in the Tree)

For above 1, I do the following:

protected void TreeView1_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e)
        foreach (TreeNode node in TreeView1.Nodes)
            TreeNodeCollection col = node.ChildNodes;
            //select all children when the parent is checked
            if (col != null && node.Checked)

How do I use Storyboarb.Children.IndexOf()

I have a storyboard in a resource that has many child DoubleAnimations, a few of which have a name assigned. These DoubleAnimations may need to have thier To property adjusted based on some user settings during run time. What I am trying to figure out, is how to retrieve the DoubleAnimation from the Storyboard,Children collection from it's Name. How can I use Storyboard.Children.IndexOf() to get the index of the DoubleAnimation who's Name is "P1Bf" then modify the To property of that DoubleAnimation. Here's the storyboard resource: <Storyboard x:Key="Fold"> <!-- Fold panel 1 from 90 to 0. --> <DoubleAnimation Storyboard.TargetName="RSC_PanelGroup1_Rotation" Storyboard.TargetProperty="Angle" To="0" Duration="0:0:0.5"/> <!-- Fold panel 2 from 90 to 0. --> <DoubleAnimation Storyboard.TargetName="RSC_Panel1and2Group_Rotation" Storyboard.TargetProperty="Angle" To="0" Duration="0:0:0.5" BeginTime="0:0:0.5"/> <!-- Fold glue tab from 0 to -90. --> <DoubleAnimation Storyboard.TargetName="GlueTab_Rotation" Storyboard.TargetProperty="Angle" To="-90" Duration="0:0:0

How to center children divs?

I am trying to center children divs which floated left by using margin: 0 auto 0 auto. It did not work. Is there any way to center them?  thanks. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="DIVAlignment.aspx.vb" Inherits="Test_DIVAlignment" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title></title>    <style type="text/css" >    #formContainer{     width:600px;          margin:0 auto 0 auto;    }    #formContainer #caption{     font-size: medium;     font-weight: bold;     text-align:center;    }         #formContainer .MetaTitle{      float: left;       margin-left:20px;       width:80px;       text-align:left;       font-weight:bold;       background-color: #cc6633;  &

Relationship between a dimension - two fact tables

I have 3 fact tables and about 10 dimensions. I want to relate both "Fact_Pop1" and "Fact_pop2" to Dim_AgeGroup. But Fact_pop1 has single age group and Fact_pop2 has no single age group (5 years age group). I spent about a day on this but I could't solve it.   Fact_Pop1 Age        Race_key            Gender_key      Geography_key              Pop_size 10           White                    M                                            CA                          10000    10           White                    F        

How to set Panel.Zindex value though XAML code if any of the Grid/UserControl children having the fo

Hi, I have a Grid with 10 buttons. If any of these buttons has focus then I want to set the Panel.Zindex = 999 for the Grid. How to do this in XAML code?Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This will help other members to find the solution easily.

How to return the results of a 1 to Many Relationship

A co-worker of mine just came back from a SQL Server Reporting Services class (we are using SQL Server 2005). In that class they were told that if they had a one to many relationship that they would have to flatten the results into one row of the resultset in order to show the 'many' portion of the relationship.  For example, my company has two tables: Jobs Notes/Memo's For each Job we can have 0 or more Notes/Memo's. According to my co-worker the Report Server must have each of the Notes/Memo's in one row of the resultset.  That we therefore have to flatten the list of Notes into Note1, Note2, Note3...etc fields.  Is this correct?  How would I handle a situation where I didn't know how many Notes there were? Thanks so much.

Excel 2003 pivot table - parent showing grand total than the sum of its children

All, In Excel 2003, I have a product hierarchy, for simplistic sake lets say it goes A > B > C > model nbr.  I have filtered on model nbr 1.  I have the product hierarchy in my pivot table and unit cnt as the measure. Starting at level A in the hierarchy I am showing a total unit of 12000, if I drill down to B it still shows 12000, if I drill down to C it shows 100 and if I drill down to model nbr it shows me model nbr 1 with a unit cnt of 100. So my question is why are my parents not filtering the model nbr, it is taking the total for ALL records that have level A as their parent regardless of the model nbr? This does NOT happen in Excel 2007 or when I browse my cube in SSAS.

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?

Relationship between Search Results and permissions

Is it true that if your account did not have permission to a document library before a crawl occurred, you will not see it in a search result - even after you are given access to the documents? Here's a sequence of events to clarify the scenario: Crawl completed on DocLib1. User1 do not have access to DocLib1. No results when doing a search. User1 is given access to DocLib1. Question : Will User1 see the results when doing a search on DocLib1? Another Crawl completed on DocLib1. User1 will see the search results now on DocLib1. Does this mean a user must have access PRIOR to the crawl to be able to view it in a search? Anyone experience this scenario before? Thanks.

Many-To-Many table relationship and model.edmx

Hello,I'm having a weird problem with the database model as it seems. I have 3 tables (posts, taggedpost, tags) and when I create the model the relationship is correctly identified as a many-to-many but the linking table is gone.Instead, VS2010 creates only 2 tables, and maps 'tags' as a "Navigation Property" of 'content' and vice versa.So problem is, I need to query for posts that have a specific tag. The best I have gone so far is to query for all posts that have at least one tag and fetch them then programatically filter them, but I want the optimal which is to select them all at once.

When adding a colleague, can I add a reciprocal relationship back?

Hi there,   I'm after functionality 'like facebook' (that must be a common phrase) I.e. when User A adds User B as a colleague, A is B's friend and most importantly B is A's friend   When I make a custom web part to show A and B their friends, they should both be on it.   The problem is if A requests B's friendship, B accepts and I forge a colleague link between B and A - that's fine, B can see A as a colleague   But, how can I tell from A that B is a colleague? ColleagueManager.IsColleague() returns true e.g. A.Colleagues.IsColleague(B) == true but B is not in A's Colleagues list (assuming two people only, A.Colleagues.GetItems().Length == 0)   The solution i've come up with is once B has accepted the 'friend request' in my own custom acceptance system, I create a UserProfile object for A and attempt to forge the link back (code below) - this however causes an UnauthorizedAccessException on the penultimate line - what am i doing wrong? Have i missed some vital part of the colleagues system? All help appreciated!   if (not already colleagues):   SPSecurity.RunWithElevatedPrivileges(delegate()                 {                     // Add the colleague relationship &

mdi children from always goes under mdi parent controls

hi there in my application i have a mdi container and some mdi children forms. i putted some controls i mdi container but when i show mdi child form, the form goes behind the mdi parent controls and some part were not shown!!!! how to solve this?
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