Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Copy of specific records and get new rows but how to make sure relationship still pointed I think cursor and scope identity()

$
0
0
Party Relationship		
Rela ID	master/Duplicate	TypeRelationshipID
1	M	A
2	M	A
3	M	B
4	D	A
5	D	C
6	M	A
7	M	C


Party Relationship Category		
Rela ID	CategoryID	
1	3	
2	5	
3	66	
4	14	
5	15	
6	17	
7	18	
Party Relationship table contains up to 5 records 3 master and 2 duplicate , i made duplicate (DD) to master and added two rows 6 and 7. I mean 6 and 7 become master from duplicate. I have party relationship category table - how to make those copied 6 and 7 acts like 4 and 5 though they are 6,7 so it connect correctly with relationship category. I know it works through scope identity(), and cursor but  i need sample code.

Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>