views:

38

answers:

3

I need to get the current 2 digit year and increment by one. So the current number I'm looking for should be 11.

Probably really simple but I'm a sql noob :)

Thanks

+2  A: 

You can do ( YEAR( GETDATE() ) % 100 ) + 1

See GETDATE & YEAR

Jon Freedman
and do the `+ 1` before the `% 100`, if you want `xx99` to yield 0 rather than 100
AakashM
+1  A: 

This will work for you

select Right(Year(getDate())+ 1,2)
Pranay Rana
A: 
SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 1),2) as YEAR
Jonathan