Difference B/W Triggers and Stored Procedurs?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sonia.sardana
    New Member
    • Jul 2006
    • 95

    Difference B/W Triggers and Stored Procedurs?

    Hey can anyone tell me whether Triggers and Stored Procedures are same?

    Triggers are stored procedures that get executed automatically when an Insert,Update,o r Delete operation takes place.

    Stored Procedures
    .------????

    If i m right,Stored procedures are similar to Functions in C??
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    you are correct.

    I would add to stored procedures
    that they execute on the server and they can, but don't have to, return a recordset like a view does.

    other than that yes they are like functions and subs in programming languages such as c, vb, java etc.

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      The only other difference is you can not embed a stored proc call in a statement, not like function

      Correct:

      If MyFunction() = 1

      But Not:

      If MyStoredProc = 1

      -- CK

      Comment

      Working...