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)
 How To Group Records Based on Sequence Number

Author  Topic 

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2011-02-01 : 16:04:04
Hi everyone,

I have some profiler trace data that I want to create a report from.

I have discovered that the records that have “contiguous” Sequence numbers are related to the same deadlock.

For example Sequence numbers 94, 95 and 96 contain information for the same deadlock.

The next deadlock records will likely have a different series of Sequence numbers – for example 101, 102 and 103. So there is a gap in the numbering.


What I need to do is group these blocks of records so I can assign a number to all the records that are associated with that deadlock occurrence.

Is this possible?

Thanks, John

eralper
Yak Posting Veteran

66 Posts

Posted - 2011-02-02 : 08:40:09
Hello John,

Using the Ranking function ROW_NUMBER with PARTITION BY you can enumarate rows according to some grouping data identified with PARTITION BY

ROW_NUMBER() OVER (PARTITION BY column1 ORDER BY sequencenumber desc) as rownum

Perhaps such a select query might help you group and number data

-------------
Eralper
http://www.kodyaz.com
Go to Top of Page
   

- Advertisement -