I have a table which has columns (ID int, RECEIPT\_BARCODE nvarchar(200),FK\_CLOSURE bigint) 

```
ID          RECEIPT_BARCODE          FK_CLOSURE  

1           01020011304500190001    58100000010019
2           01020011304500190002    58100000010019
1           01020011404500200001    58100000010020
2           01020011404500200002    58100000010020
3           01020011404500200003    58100000010020
1           01020011504500210001    58100000010021
1           01020011604500220001    58100000010022
1           01020011604500230001    58100000010023
2           01020011604500230002    58100000010023
1           01020011604500250001    58100000010025
3           01020011604500250003    58100000010025

```

Our program is automatically inserting the sales into the table. This table is being inserted like;
when FK\_CLOSURE up, ID is being set again to '1' (as you can see above) then it goes sequential as long as FK\_CLOSURE doesnt change. When FK\_CLOSURE change again, ID is set to '1'. 

So the problem is; sometimes our sale program works wrong and doest insert a sale however increase the ID value as you can see in the last row. In the last row it increased ID from 1 to 3, there is no 2... 

and i would like to report that kind of fails. I tried to use CURSOR but couldn't manage.
Any suggestions ?