How To Test a DML Trigger in MS SQL Server?
Submitted by: AdministratorTo 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.
Submitted by: Administrator
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.
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | How To Create a View on an Existing Table in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Create a Large Table with Random Data for Index Testing in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |