Hierarchy in SQL Server

Results 1 to 2 of 2

Thread: Hierarchy in SQL Server

  1. #1
    Join Date
    Dec 1969

    Default Hierarchy in SQL Server

    How to specify the relationship between parent rows and child rows of the hierarchy ?<BR>For example in Oracle we have START WITH and CONNECT TO clauses to find out the hierarchy of records.<BR><BR>Here is my problem:<BR>OrgID ParentID Points<BR>120 NULL 100<BR>121 120 15<BR>122 120 20<BR>123 121 25<BR>124 122 20<BR><BR>Finally, I need to sum all the child organization points for 120, thus having the total as 180.<BR><BR>Thank you all in advance for looking into this.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Hierarchy in SQL Server

    SQL server does not have any specific support for hierarchical queries. You can solve it by using a recursive stored procedure. I&#039;ve seen an article at www.msdn.com (search for hierarchy)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts