Hi all,
I need a way to assign the next sequential (permit) number to an approved application. The trick is that every fiscal year the numbers restart at zero and the fiscal year is between 7/1/xx and 6/30/xx.
for example if an application was approved on 8/4/03 i would need to get the next permit number between 7/1/03 and 6/30/04.
Here is what i'm playing with:
The problem is getting the fiscal year start end end date range that the ApprDate falls into.
I need a way to assign the next sequential (permit) number to an approved application. The trick is that every fiscal year the numbers restart at zero and the fiscal year is between 7/1/xx and 6/30/xx.
for example if an application was approved on 8/4/03 i would need to get the next permit number between 7/1/03 and 6/30/04.
Here is what i'm playing with:
Code:
@ApprDate datetime
DECLARE @LastNo INT
DECLARE @NewNo INT
SELECT @LastNo = (SELECT MAX(PermitNo) FROM tblApplication WHERE ApprDate BETWEEN '7/1/xx' AND 6/30/xx')
SELECT @NewNo = (@LastNo + 1)
return @NewNo
The problem is getting the fiscal year start end end date range that the ApprDate falls into.