Collections:
Testing DML Triggers in SQL Server
How To Test a DML Trigger in SQL Server?
✍: FYIcenter.com
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 FyiCenterData;
GO
INSERT INTO fyi_users (name) VALUES ('FYI Admin');
GO
Records are inserted, updated, or deleted in fyi_users
(1 row(s) affected)
UPDATE fyi_users SET email='root@fyicenter'
WHERE name = 'FYI Admin';
GO
Records are inserted, updated, or deleted in fyi_users
(1 row(s) affected)
DELETE FROM fyi_users WHERE name = 'FYI Admin';
GO
Records are inserted, updated, or deleted in fyi_users
(1 row(s) affected)
The trigger, dml_message, is working as expected.
⇒ sys.triggers - Listing All Triggers in the Database in SQL Server
⇐ "CREATE TRIGGER" - Creating a DML Trigger in SQL Server
2016-10-25, 2458🔥, 0💬
Popular Posts:
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want t...
What Are Out-of-Range Errors with DATETIME values in SQL Server Transact-SQL? When you enter DATETIM...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...
How to download and install SQL Server 2005 Sample Scripts in SQL Server? If you want to learn from ...
How To Convert Binary Strings into Hexadecimal Character Strings in SQL Server? When a query returns...