Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
How To Create a DML Trigger using CREATE TRIGGER Statements?
Submitted by: AdministratorA DML trigger is a trigger declared to handle a DML event, which occurs when an INSERT, UPDATE or DELETE statement is executed. If you want to create a DML trigger, you should use the "CREATE TRIGGER" statement in the following format:
CREATE TRIGGER trigger_name ON table_name
AFTER INSERT, UPDATE, DELETE
AS
statements
GO
The tutorial exercise below shows you a very simple DML trigger defined on the ggl_users table. It does nothing but printing a simple static message.
USE GlobalGuideLineDatabase;
GO
CREATE TRIGGER dml_message ON ggl_users
AFTER INSERT, UPDATE, DELETE
AS
PRINT 'Records are inserted, updated,'
+ ' or deleted in ggl_users';
GO
Command(s) completed successfully.
A simple DML trigger is defined on ggl_users now.
Submitted by: Administrator
CREATE TRIGGER trigger_name ON table_name
AFTER INSERT, UPDATE, DELETE
AS
statements
GO
The tutorial exercise below shows you a very simple DML trigger defined on the ggl_users table. It does nothing but printing a simple static message.
USE GlobalGuideLineDatabase;
GO
CREATE TRIGGER dml_message ON ggl_users
AFTER INSERT, UPDATE, DELETE
AS
PRINT 'Records are inserted, updated,'
+ ' or deleted in ggl_users';
GO
Command(s) completed successfully.
A simple DML trigger is defined on ggl_users now.
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.