Assuming you are going to include the Year as part of the "final" invoice number and the number you are trying to reset is just the "number of invoices so far this year" then have a look at the solution at
Invoice no should starting with 1 for every finacial year[
^] - please, please, please read ALL of the comments before using the suggested solution.
Some other points about your SQL.
Don't use strings to construct dates. If you want the 1st April in the current year, add 3 months to the first date of the current year thus:
dateadd(mm, 3, dateadd(yy, datediff(yy, 0, GETDATE()), 0))
You can get 31st March of the following year in a similar way with
dateadd(dd, -1, dateadd(mm, 3, dateadd(yy, datediff(yy, 0, GETDATE()) + 1, 0)))
I adapted these from my go-to reference for dates from Lynn Pettis at
Some Common Date Routines – SQLServerCentral[
^]
Secondly - use an unambiguous date format - see
Date formatting - Globalization | Microsoft Learn[
^], use ISO 8601 standards
In other words - is 04/01/2022 4th January or 1st April? 2022-04-01 makes it clear which one you mean. As does 20220401.
2022-APR-01 is also clearer - but assumes English speaking environment. If you are extracting dates to be displayed then worry about the "format" in the Display layer and no earlier.