This will return the appropriate graduation year (as in class of 2019) for the student based on the year of the database and grade of the student.


SELECT id,gr,'20' + SUBSTRING(db_name(),4,2) +(13-gr) as [GradYear]
FROM stu




It can be done in an Aeries Query in the web too.

Anticipated Grad Year…

LIST STU ID NM GR (( CAST(SUBSTRING(DB_NAME(),4,2) AS DECIMAL (2) ) + 12 - GR + 2001 ))