Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303

    Unanswered: Stored Proc / Triger

    Hi,
    Guys I want to ask this question. What is the difference between stored Proc and Triger? and can u give a sample code of each one .

    Thanks...

  2. #2
    Join Date
    Dec 2004
    Location
    York, PA
    Posts
    95
    A Trigger fires when an event takes place such as insert update or delete of data on a table and is attached to a specific table

    A Stored procedure can be used at any time and is not specific to any event
    Sorry to be terse
    some say it's a curse
    I know it's worse
    I'm just diverse

  3. #3
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    74
    In a trigger you also have acces to the virtual tables inserted and deleted. These tables hold the values that is going to be either inserted or deleted depending on the operation in question. A insert-command generates posts in the inserted-table, a update-command generates posts in both the inserted and the deleted since the update actually is a delete followed by a insert and finally the delete command only generates posts in the deleted table.

    If you want help on creating triggers I suggest reading the SQL Server Books Online help to get the most relevant info. Try searching for the keywords CREATE TRIGGER
    That should get you started pretty good.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •