Database Management Exam  >  Database Management Videos  >  SQL Server Administration: Basic Tutorials  >  DML triggers in sql server Part 43

DML triggers in sql server Part 43 Video Lecture | SQL Server Administration: Basic Tutorials - Database Management

148 videos

FAQs on DML triggers in sql server Part 43 Video Lecture - SQL Server Administration: Basic Tutorials - Database Management

1. What are DML triggers in SQL Server?
Ans. DML triggers in SQL Server are special types of stored procedures that are automatically executed when a Data Manipulation Language (DML) event occurs on a specified table or view. These triggers can be used to enforce business rules, audit changes, or perform additional actions based on the DML operation.
2. How are DML triggers created in SQL Server?
Ans. DML triggers in SQL Server can be created using the CREATE TRIGGER statement. This statement allows you to specify the trigger name, the table or view on which the trigger should be applied, the DML event (INSERT, UPDATE, or DELETE) that should activate the trigger, and the code to be executed when the trigger is fired.
3. What are the types of DML triggers supported by SQL Server?
Ans. SQL Server supports two types of DML triggers: After triggers and Instead Of triggers. After triggers are executed after the DML operation has been completed, while Instead Of triggers are executed instead of the DML operation. After triggers are commonly used for auditing and logging purposes, while Instead Of triggers are often used to modify or validate the data before the actual DML operation occurs.
4. Can multiple triggers be created for the same DML event on a table in SQL Server?
Ans. Yes, it is possible to create multiple triggers for the same DML event on a table in SQL Server. However, the order of execution of these triggers is not guaranteed unless you explicitly specify it using the sp_settriggerorder system stored procedure. It is important to carefully design and manage multiple triggers to avoid conflicts or unintended consequences.
5. How can DML triggers be disabled or dropped in SQL Server?
Ans. DML triggers can be disabled or dropped in SQL Server using the ALTER TABLE statement. To disable a trigger, you can use the DISABLE TRIGGER option followed by the trigger name. To drop a trigger, you can use the DROP TRIGGER statement followed by the trigger name. It is important to note that disabling or dropping a trigger will permanently remove its functionality and it cannot be undone without recreating the trigger.
Explore Courses for Database Management exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Important questions

,

past year papers

,

Previous Year Questions with Solutions

,

practice quizzes

,

MCQs

,

DML triggers in sql server Part 43 Video Lecture | SQL Server Administration: Basic Tutorials - Database Management

,

DML triggers in sql server Part 43 Video Lecture | SQL Server Administration: Basic Tutorials - Database Management

,

shortcuts and tricks

,

Viva Questions

,

Exam

,

Semester Notes

,

Objective type Questions

,

Sample Paper

,

Free

,

pdf

,

ppt

,

study material

,

Summary

,

Extra Questions

,

video lectures

,

DML triggers in sql server Part 43 Video Lecture | SQL Server Administration: Basic Tutorials - Database Management

,

mock tests for examination

;