I need to get the current 2 digit year and increment by one. So the current number I'm looking for should be 11. How?
I need to get the current 2 digit year and increment by one. So the current number I'm looking for should be 11. How?
For SQL Server 2012 and above, I'd suggest using FORMAT(@DATE, 'yy'):
SELECT FORMAT(DATEADD(year, 1, GETDATE()), 'yy')
Format offers a cleaner, more readable solution. Thus, less guesswork, and a better maintainability.
If you are always going to be using GetDate() why not just do something like this:
Select (Year(GetDate()) - 2000) + 1
Dang people. Always making things so complicated. It's not like you are going to be living for another 1000 years!