I have a problem in counting month's difference from 2 date with sql server query
i tried using DATEDIFF(MONTH, SD, ED)
this for example
SD = '2013-12-10 00:00:00.000'
ED = '2014-12-09 00:00:00.000'
SELECT DATEDIFF(MONTH, SD, ED)
--result : 12 //this correct result
SD = '2013-12-10 00:00:00.000'
ED = '2014-12-10 00:00:00.000'
SELECT DATEDIFF(MONTH, SD, ED)
--result : 12 //this incorrect result, the result that i want is 13
SD = '2013-12-10 00:00:00.000'
ED = '2014-12-15 00:00:00.000'
SELECT DATEDIFF(MONTH, SD, ED)
--result : 12 //this incorrect result, the result that i want is 13
SD = '2013-12-01 00:00:00.000'
ED = '2014-11-30 00:00:00.000'
SELECT DATEDIFF(MONTH, SD, ED)
--result : 11//this incorrect result, the result that i want is 12
is there any solution to get correct result of month difference of 2 date?? can someone help me?
Thanks