As far as I known you can not debug trigger code, because a trigger is executed event driven (DML), not as a directly part of you code execution.
How to debug a trigger in ssms 20.2, sql 2019
How to debug a sql 2019 table tigger in ssms, i am nit seeing debug in ssms
3 answers
Sort by: Most helpful
-
-
Erland Sommarskog 112.7K Reputation points MVP
2024-09-03T21:11:59.26+00:00 You debug it with PRINT and SELECT statements.
Older versions of SSMS had a debugger, but there were lots of issues, particularly if you wanted to debug on a remote instance. Myself, I gave up using a debugger for SQL Server twenty years ago. Too much hassle to get it working. And the returns were diminishing, since you could not inspect tables.
-
LiHongMSFT-4306 28,041 Reputation points
2024-09-04T02:24:50.2766667+00:00 There is direct way to debug triggers in SSMS. You could use print statements or temporary tables to check results.
Also, you could use SQL Server Data Tools (SSDT) to debug particular database objects, such as stored procedures and triggers.
See this doc: How to: Debug Database Objects.
Best regards,
Cosmog
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".