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)
 hierachy with parent

Author  Topic 

scottichrosaviakosmos
Yak Posting Veteran

66 Posts

Posted - 2012-08-05 : 05:03:44
Childid Childname Parentid pid
100 Bingo 200 1
101 Pingo 201 1
102 Zingo 201 1
100 Bingo 201 2
101 Pingo 200 2
102 Zingo 201 2
100 Bingo 201 3
101 Pingo 201 3
102 Zingo 200 3
100 Bingo 200 4
101 Pingo 201 4
102 Zingo 200 4





As we can see in this table that ‘100’ has multiple parents for different Pids.
100=200 and 100=201 , So I want to creating a query that will check in previous id whether childid is mapped with new parentid . if parent has changed then create a new childid with same childname.
What about doing same thing in a historical table where the parent of 100 has changed many times.
How to get a data where we can find when all the parent of child has changed from all past Pid’s.


scoo

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-05 : 14:59:19
so you want it to be done each time on insertion of new record?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -