Introduction
Triggers in SQL Server 2012 are a special kind of stored procedure that fires automatically; they are invoked or executed when an event occurs in the database server. We can create Data Manipulation Language (DML) triggers and Data Definition Language (DDL) triggers in SQL Server 2012.
When the user wants to modify data using a DML event then the DML trigger is executed. In other words, a DML trigger is used for INSERT, DELETE and UPDATE statements of a table or view.
When the user attempts to perform an operation using DDL then the DDL trigger is executed. In other words, a DDL trigger is executed for CREATE, ALTER and DROP statements of a table or view.
There are three types of triggers in SQL Server 2012:
- AFTER Trigger
- INSTEAD OF Trigger
- FOR Trigger
Statement that create vendors_info table in SQL Server 2012
- create table vendors_info
- (
- vendorid int,
- vendorname varchar(15),
- vendorcity varchar(15),
- vendorstate varchar(15)
- )
- insert into vendors_info values (20,'vipendra','noida','up')
- insert into vendors_info values (21,'deepak','lucknow','up')
- insert into vendors_info values (22,'rahul','kanpur','up')
- insert into vendors_info values (23,'malay','delhi','delhi')
- insert into vendors_info values (24,'mayank','noida','up')



pragadesh sivajiPosted Aug 29, 2012, 2:51 AM
Expect More About Sql Sever Updates more in future!