T-SQL: Build Nested Set From Parent-Child Relationship
Posted
by Peder Rice
on Stack Overflow
See other posts from Stack Overflow
or by Peder Rice
Published on 2010-04-15T22:35:46Z
Indexed on
2010/05/02
11:17 UTC
Read the original article
Hit count: 294
I have a table that stores my Customer hierarchy with a nested set (due to the specific design of the application, I wasn't able to leverage just a Customer/Parent Customer mapping table).
To simplify maintenance of this table, I've built a couple of stored procedures to handle moving nodes around and creating new nodes, but it's significantly more work than maintaining a Customer/Parent Customer table. Further, these structures are very fragile.
So I'm looking for a way to have a Customer/Parent Customer table and then convert that table to a nested set on demand. Does anyone have a link to such an implementation?
© Stack Overflow or respective owner