/ Published in: SQL
Had to write this for work to automatically convert current year's 2-digit value to a string containing current year's 2-digit value and next years's 2-digit value.. for example:
0607, 0708, 0809, 0910
This assumes that the table column that contains the current year's 2-digit representation is called "SSSSY2"
Expand |
Embed | Plain Text
SUBSTRING(CAST(DATEPART(year , DATEADD(year , 1 , '01/01/' + CAST(s.[SSSSY2] AS CHAR(2)))) AS CHAR(4)) , 3 , 2)
You need to login to post a comment.
