Q: Operand type clash: date is incompatible with int with variable in a PRINT statement I am trying to create a trigger in MS sql server, but I keep receiving a 'Operand type clash: date is incompatible with int' error. I think the error is coming from my PRINT statements but I am not versed enough in sql to know how overcome this problem.
ALTER TRIGGER utrInsteadUpdateTblMembership
ON tblMembership INSTEAD OF UPDATE
AS
BEGIN
    DECLARE @newPayDate date, @prevPayDate Date, @prevMemberNumber int

    Select @newPayDate = MembershipFeePaidDate FROM inserted
    Select @prevPayDate = MembershipFeePaidDate FROM deleted
    Select @prevMemberNumber = MembershipID FROM deleted 


    IF @prevPayDate IS NOT NULL AND @prevPayDate > @newPayDate
        BEGIN 
            UPDATE tblMembership 
                SET MembershipFeePaidDate = @newPayDate 
                WHERE @prevMemberNumber = MembershipID 
            UPDATE tblMembership 
                SET isCurrentMember = 1
                WHERE @prevMemberNumber = MembershipID 
            PRINT 'Membership Number ' + @prevMemberNumber + ':' + ' payment date is ' + @newPayDate + ';' + ' prior payment date is ' + @prevPayDate
        END
    ELSE
        BEGIN
            PRINT 'Membership Number ' + @prevMemberNumber + ':' + ' new payment date ' + @newPayDate + ' is earlier than prior payment date ' + @newPayDate +';' + 'No change made' 
        END
END


A: It's cause it interprets it like addition versus concatenation. The same applies for Dynamic SQL
 PRINT 'Membership Number ' + cast(@prevMemberNumber as char(8)) + ':' + ' new payment date ' + convert(varchar(10),@newPayDate,101) + ' is earlier than prior payment date ' + convert(varchar(10),@newPayDate,101) +';' + 'No change made'

