>>I tried changing the logic to this:
>>
>>
IF @MonthsToAdd = 0 OR @MonthsToAdd = NULL
>> BEGIN
>> SET @DatePaidTo = @IssueDate
>> END
>> ELSE
>> BEGIN
>> SET @DatePaidTo = ISNULL(DATEADD(M, @MonthsToAdd, @IssueDate), @IssueDate)
>> END
>>
>>
>>and that has got it, but I'm not sure why :(
>
>I was just going to make a better suggestion
>
>set @MonthsToAdd = coalesce(@MonthsToAdd,0) and keep your original code.
>
>Also, you can not write @MonthsToAdd = NULL. The check for NULL should always use IS word, not equal sign.
Thanks