Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Test a DML Trigger in MS SQL Server?

To test a DML trigger defined on a table, you just need to execute several INSERT, UPDATE and DELETE statements on that table as shown in this tutorial example:

USE GlobalGuideLineDatabase;

GO

INSERT INTO ggl_users (name) VALUES ('GGL Admin');

GO

Records are inserted, updated, or deleted in ggl_users

(1 row(s) affected)

UPDATE ggl_users SET email='root@ggl'

WHERE name = 'GGL Admin';

GO

Records are inserted, updated, or deleted in ggl_users

(1 row(s) affected)

DELETE FROM ggl_users WHERE name = 'GGL Admin';

GO

Records are inserted, updated, or deleted in ggl_users

(1 row(s) affected)

The trigger, dml_message, is working as expected.

 142 views

More Questions for you: