SQL Fiddle of the following:
SELECT DATEDIFF(month,
CONVERT(VARCHAR(19),
CAST(MonthFROM as varchar) + '/01/' + CAST(YearFROM as varchar),
101),
CONVERT(VARCHAR(19),
CAST(MonthTo as varchar) + '/01/' + CAST(YearTO as varchar),
101)) + 1 AS MonthPast
FROM MyTable;
The result would be:
MONTHPAST
14
The actual months difference is 13
but you had 14
as what you are expecting as a result. If your calculation was wrong and you indeed need 13
then remove the + 1
from the query.