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.
148 videos
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

Free

,

Sample Paper

,

MCQs

,

Exam

,

shortcuts and tricks

,

ppt

,

Previous Year Questions with Solutions

,

mock tests for examination

,

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

,

pdf

,

Objective type Questions

,

Extra Questions

,

Semester Notes

,

Summary

,

video lectures

,

study material

,

practice quizzes

,

past year papers

,

Important questions

,

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

,

Viva Questions

;