I am trying to pass two 10 digit telephone number block using TSQL.
Lets say:
TelephoneNumber1: 1234560095
TelephoneNumber2: 1234561005
My Table consists of 3 columns:
ID, StartBlock, EndBlock
1, 5671231000, 5671232000
2, 1234561000, 1234562000
3, 2175551200, 2175551300
So what I am trying to do is find all the numbers between TelephoneNumber1 and TelephoneNumber2 and see if it exists between any records between StartBlock and EndBlock in the table.
In this example, it would find a number already in use in the second record because
when 1234560095 gets to 1234561000, it will find it in already in use.
How do I accomplish this to find a number in use between the StartBlock and EndBlock?
1 Answer