Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Hierarchy

Author  Topic 

IBoonZ
Yak Posting Veteran

53 Posts

Posted - 2009-03-24 : 07:03:38
Hi

I got following data

ContractID // Contractpos //ParentID

3333 // 1 // 0
3333 // 2 // 0
3333 // 3 // 2
3333 // 4 // 2
3333 // 5 // 0



If ParentID is null then its a positon, so i need a new collumn table, if ParentID is like here '2' then its a SUBposition of my contractposition 2.

So is it possible to get something like this :

ContractID // Contractpos //Contractsubpos

3333 // 1 // 0
3333 // 2 // 3
3333 // 2 // 4
3333 // 5 // 0

If you have a better solution, greatly appriciated.

I want to create a hierarchy

Thanks

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-03-26 : 11:53:49
Sorry - can you explain this again. Are these tables, do you want to create tables ....?

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -