• Senchi - Monday, January 16, 2017 8:02 AM

    ALTER TRIGGER [dbo].[tr_datediff] ON [dbo] [JOURNAL]  FOR INSERT,UPDATE
    AS
    SELECT DATEDIFF(d,start_date,end_date) [diff],[TimeDiff] FROM JOURNAL

    start_date is datetime
    end_date is datetime
    TimeDiff is varchar(50)

    And yet it does not work.

    What are you doing with the results of this DATEDIFF?  Are you really trying to return results from the trigger?  I didn't think this was supported anymore:
    https://technet.microsoft.com/en-us/library/ms186337(v=sql.110).aspx
    You could store it in a variable and do something else with it after that maybe, it depends what you are going to use the value returned for.