troubleshooting Question

SQl Query to find x consecutive Nbrs in a Table

Avatar of AlexPonnath
AlexPonnathFlag for United States of America asked on
Microsoft SQL ServerSQL
27 Comments1 Solution229 ViewsLast Modified:
I have the need to query a table which has phone numbers Listed for consecutive nbrs.
My table hs numbers stored as int like

9255551000
9255551010
9255551011
9255551012
9255551013
9255551014
9255551015
9255551020
9255551021
9255551022
9255551023
9255551024
9255551025

I want to create an SP where i can say find for example block of 5 where the 5 is the number of consecutive nbrs i want
based on my sample data there should be 2 blocks and it should return the lowest nbr as the block start

Any idea how to achive that
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 27 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 27 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros