You might find this helpful
http://www.sqlservercentral.com/Forums/Topic267061-176-2.aspx#bm1135582
-- Author: Martin Grape
Be sure to read the comments posted by:
--Comment by Jeff Moden
----The only problem is that the code doesn't recognize missing "SysID" of 1.
-- In fact, it doesn't recognize any gap from 1 to x-1 if all the rows between 1 to x-1 are missing.
In addition to receive tested help, please post table definitions, sample data, expected results in a readily consumable format. To learn how to do so quickly and easily click on the first link in my signature block .. by the way the article includes T-SQL code which you can use to do just what I am requesting.
If everything seems to be going well, you have obviously overlooked something.
Ron
Please help us, help you -before posting a question please read[/url]
Before posting a performance problem please read[/url]