Hi!
I am searching the MS SQL forum for an answer to a need I have. I came across the FAQ: How Can I Find Gaps in Date and Number Sequences?
faq183-840.
I wonder if this is on the right track or if you someone could at least point me in the right direction? I am not a programmer or database expert. Basically, I'm a CPA who works as a consultant for accounting software running on MS SQL databases.
What I want to do is search a table holding financial transactions and first restrict the type to "check" (CMTrxType=3). I also want the user to be able to change the range (CMTrxNum between '10500' and '10504').
The part I can't figure out is how I determine a missing number from the CMTrxNum range? So, I select checks between 10500 and 10504 and I want to know which numbers are missing (e.g. 10502) so that I can insert a record to add this number with other information. The purpose is to enter voided checks for missing numbers between a certain range.
Can anyone help me with this? Or, maybe tell me what to search for in SQL Books Online or on the forum. Searching on "missing" just isn't cutting it.
I appreciate any help.
Thanks!
I am searching the MS SQL forum for an answer to a need I have. I came across the FAQ: How Can I Find Gaps in Date and Number Sequences?
faq183-840.
I wonder if this is on the right track or if you someone could at least point me in the right direction? I am not a programmer or database expert. Basically, I'm a CPA who works as a consultant for accounting software running on MS SQL databases.
What I want to do is search a table holding financial transactions and first restrict the type to "check" (CMTrxType=3). I also want the user to be able to change the range (CMTrxNum between '10500' and '10504').
The part I can't figure out is how I determine a missing number from the CMTrxNum range? So, I select checks between 10500 and 10504 and I want to know which numbers are missing (e.g. 10502) so that I can insert a record to add this number with other information. The purpose is to enter voided checks for missing numbers between a certain range.
Can anyone help me with this? Or, maybe tell me what to search for in SQL Books Online or on the forum. Searching on "missing" just isn't cutting it.
I appreciate any help.
Thanks!