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.
| Author |
Topic |
|
nasty84
Starting Member
6 Posts |
Posted - 2010-01-13 : 15:22:21
|
| For e.g i have the following dataID Source Segment Groupid Sequence SegSeq SegGroupseq1 1 A1 100 1 null null2 1 A2 100 2 null null3 1 A3 100 3 null null4 2 B1 100 4 null null5 1 A2 100 5 null null6 1 A3 100 6 null null7 1 B1 100 7 null null8 1 A1 200 1 null null-----i need to update the SegSeq and SegGroupseq i.e, the data should look like this...ID Source Segment Groupid Sequence SegSeq SegGroupseq1 1 A1 100 1 1 12 1 A2 100 2 2 13 1 A3 100 3 3 14 2 B1 100 4 1 15 1 A2 100 5 3 26 1 A3 100 6 3 37 2 B1 100 7 1 28 1 A1 200 1 1 1-----For a groupID, different segments can occur.For a groupID, if a new segment occurs we have to increment the SegSeq. But, if the segment occurs again in the same groupID, we need to update it with last maximum number of that groupID segment's SegSeq number.And incrment the SegGroupSeq. If a new source starts with different segmenr and for the same group SegSeq and starts with 1.Is there any way without using Cursors.Thanks for your help and time.. |
|
|
|
|
|