Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Trigger

Author  Topic 

pawansoft
Starting Member

1 Post

Posted - 2008-12-05 : 01:42:38
give me the practical use of trigger.

pawan kumar singh

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-05 : 01:43:56
I like to call executables that require user input in triggers. Throw in a couple of cursors, dynamic SQL, a few WAITFORs and now we've got a party.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2008-12-05 : 10:46:17
You funny, Tara.

pawan, triggers are useful for maintaining complex data integrity rules, and for data archiving.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-12-05 : 11:36:59
quote:
give me the practical use of trigger.

You pull it to make something something happen. Usually something bad.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-05 : 12:55:22
One of most common use is table Auditing, tracking changes happening on a table onto history table for things like retrospective data analysis
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-05 : 13:00:02
Triggers are also sometimes used to modify data or do other actions when you don't have access to the source code of the application such as with a 3rd party application or perhaps even with a legacy application.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -