I am trying to find a query that can determine if there is a sequence of numbers of 3 or more numbers in a string (varchar). This is for SQL Server
Example row: "521324567" This data row will be returned because it has the sequence "4567".
Example line: "410747823" This data line will not be returned because there is no sequence of 3 or more numbers.
Example row: "1274563619" This data row will be returned since it has the sequence "456".
I think that I could probably compute something similar to sql below if it were a fixed-length string.
Select num from numbers where substring(num,2,1)=
(select substring(num,1,1)) + 1
source
share