Geeks Talk

Prepare for your Next Interview




what is a trigger?

This is a discussion on what is a trigger? within the SQL Server forums, part of the Databases category; what is main difference between ddl trigger and dml trigger?...


Go Back   Geeks Talk > Databases > SQL Server

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-17-2007
Junior Member
 
Join Date: Nov 2007
Location: bangalore
Posts: 29
Thanks: 11
Thanked 6 Times in 2 Posts
srinu.tenali is on a distinguished road
Post what is a trigger?

what is main difference between ddl trigger and dml trigger?
Reply With Quote
The Following 5 Users Say Thank You to srinu.tenali For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 12-17-2007
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 428
Thanks: 17
Thanked 53 Times in 53 Posts
susarlasireesha is on a distinguished road
Re: what is a trigger?

DDL tiggers are operate on Create, Drop,Alter and are useful to perform administrative tasks and enforce business rules.

DMl triggers are operate on Insert,Update,Delete and they are useful to enforce business rules and maintain data integrity when dml commands operate on tables(views).
Reply With Quote
  #3 (permalink)  
Old 12-20-2007
Junior Member
 
Join Date: Dec 2007
Location: India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
shobi_at is on a distinguished road
Thumbs up Re: what is a trigger?

A DML trigger is a stored procedure that goes into effect when you insert, delete, or update data in a table. You can use triggers to perform a number of automatic actions, such as cascading changes through related tables, enforcing column restrictions, comparing the results of data modifications, and maintaining the referential integrity of data across a database.

DML Triggers are automatic. They work no matter what caused the data modification. A trigger is specific to one or more of the data modification operations, update, insert, and delete and is executed once for each SQL statement.

For example, to prevent users from removing any publishing companies from the publishers table, you could use this trigger:


Thanks
Shobi

Last edited by shobi_at : 12-20-2007 at 12:31 AM.
Reply With Quote
  #4 (permalink)  
Old 12-31-2007
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,369
Thanks: 7
Thanked 123 Times in 111 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: what is a trigger?

1.DDL triggers fire on execution of the dependent DDLs ,like create,alter or drop.

2.DMl triggers fire on execution of the dependent DMLs like insert,update,delete .
Reply With Quote
  #5 (permalink)  
Old 02-27-2008
Junior Member
 
Join Date: Feb 2008
Location: new delhi
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
shilpa.19in is on a distinguished road
Smile Re: what is a trigger?

A trigger is a set of actionsthat are executed automatically whenever a specified event occurs to a specified base table. the event can be an insert,update or delete operation.

or we can say that a trigger is a set of actions that run automatically when a specified change or read operation is performed on a specified physical database file...
Reply With Quote
The Following User Says Thank You to shilpa.19in For This Useful Post:
  #6 (permalink)  
Old 04-22-2008
Junior Member
 
Join Date: Apr 2008
Location: visakhaptnam
Posts: 18
Thanks: 2
Thanked 2 Times in 1 Post
ushalakshmi is on a distinguished road
Re: what is a trigger?

A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs.
Triggers are stored in and managed by the DBMS.Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed.

DDL Triggers r operate on Crete,Drop,Alter.
DML Triggers r operate on Insert,Update,Delete.
Reply With Quote
  #7 (permalink)  
Old 04-23-2008
Junior Member
 
Join Date: Apr 2008
Location: Hyderabad
Posts: 24
Thanks: 1
Thanked 4 Times in 2 Posts
nageshkota is on a distinguished road
Re: what is a trigger?

Trigger is a automatic action which can fire when an action is performed.
Reply With Quote
  #8 (permalink)  
Old 05-14-2008
Junior Member
 
Join Date: May 2008
Location: pune
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
rushsun is on a distinguished road
Re: what is a trigger?

Who we can know weather Trigger is fired or not.
Reply With Quote
  #9 (permalink)  
Old 07-24-2008
Junior Member
 
Join Date: Jul 2008
Location: Hyderabad
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
mobinsk is on a distinguished road
Re: what is a trigger?

Trigger is a event based action.
whenever we perform insert,update and delete actions then it will fires automatically.
Reply With Quote
  #10 (permalink)  
Old 07-28-2008
Junior Member
 
Join Date: Jul 2008
Location: Bangalore
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
K.P.JAYASHREE is on a distinguished road
Re: what is a trigger?

Triggers are the event based actions which are fired whenever the event on DDL and DML commands takes place
Reply With Quote
  #11 (permalink)  
Old 09-02-2008
Junior Member
 
Join Date: Feb 2008
Location: chennai
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
ckarthick is on a distinguished road
Re: what is a trigger?

trigger mainly used to implement business rules, we can perform only DML operations in trigger, trigger is implicitly called by the database
Reply With Quote
Reply

  Geeks Talk > Databases > SQL Server


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Which trigger will fires first? JobHelper SQL 5 01-24-2008 07:54 AM
what is trigger amaravadi11 SQL 8 01-23-2008 03:10 PM
schmitt trigger cadelyhde Electrical Engineering 0 02-15-2007 10:00 AM
schmitt trigger cadelyhde Electrical Engineering 0 02-15-2007 09:57 AM
mutating trigger sudipta82 Oracle 1 02-08-2007 01:53 AM


All times are GMT -4. The time now is 05:27 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved