How to debug a T-SQL trigger?

前端 未结 4 1550
清歌不尽
清歌不尽 2021-02-03 23:15

I have a table t, which has an \"after insert\" trigger called trgInsAfter. Exactly how do i debug it? i\'m no expert on this, so the question and steps performed might look sil

4条回答
  •  无人共我
    2021-02-03 23:32

    I also wasn't able to Step Into, it would go straight over my INSTEAD OF INSERT trigger. So I ended up replacing the trigger with:

    ALTER TRIGGER [MyView_Instead_Insert] 
       ON  [MyView] 
       INSTEAD OF INSERT
    AS 
    BEGIN
    SET NOCOUNT ON
    
    select * into temp from INSERTED
    
    END
    

    Which created a table called temp with exaclty the column names and values of INSERTED.

提交回复
热议问题