• It's because of the CHAR(2).

    SQL Server has to convert @EndYear to an integer to do the math, and then convert the result to CHAR(2) as you request. As pointed out at https://technet.microsoft.com/en-us/library/ms191530(v=sql.105).aspx, when you try to convert an integer to a string type that is too small to fit the full integer (as is the case here, trying to put a 4 digit integer into a two character string), an asterisk is returned.

    The resulting string '7/31/*' is not a string that can be converted to smalldatetime.

    You could just switch the CHAR(2) to a CHAR(4) and the commands would work.

    If you are on 2012, I would probably prefer declaring the variable as an integer and using DATEFROMPARTS instead for readability, but this should at least get you around your immediate problem.

    Cheers!