• As welll as what Lowell says, you need to distinguish between the three possible causes of entering the trigger: Insert, update, and delete. Also, if you are signalling unexpected events, you shouldn't restrict your trigger to single row operations - after all, it's supposed to tell you when something unexpected happens, and maybe multi-wow inserts/updates/deletes are unexpected?

    You could comboine that with what Lowell said and get something like this:-

    declare @optype tinyint = 0;

    if exists (select * from inserted) set @optype = @optype+1

    if exists (select * from deleted) set @optype = @optype+2

    set @Subject =

    case @optype

    when 1 then 'New row inserted into ConfigSet table in XXXXXX'

    when 2 then 'Row deleted from ConfigSet table in XXXXXX'

    when 3 then 'Row modified in ConfigSet table in XXXXXX'

    else 'This should never happen'

    end ;

    of @optype = 1 or optype = 3 set @Body = 'New rows:'

    if @optype = 1 or @optype = 3

    select @Body = @Body + <newline marker> +

    ISNULL(@ConfigSetID_Ins,'[Missing ConfigSet]') +','

    ISNULL(@Name ,'[Missing Name]')+','

    ISNULL(@Version,'[Missing Version]')+','

    ISNULL(@Timestamp,'[Missing Timestamp]')+ <newline marker>

    from inserted ;

    if @optype = 2 or @optype = 3

    select @Body = @Body + 'Old Records:' + <newline marker> +

    ISNULL(@ConfigSetID_Ins,'[Missing ConfigSet]') +','

    ISNULL(@Name ,'[Missing Name]')+','

    ISNULL(@Version,'[Missing Version]')+','

    ISNULL(@Timestamp,'[Missing Timestamp]')+ <newline marker>

    from deleted ;

    Tom