locked
Which of the follow about trigger and stored procedure in SQL server is false? RRS feed

  • Question

  • a) A trigger cannot have parameter but a stored procedure can have.
    b) A trigger does not contain application logic but a stored procedure can contain application logic
    c) A trigger is not explicitly called but a store procedure is
    d) A trigger is attached to a table or a view but a stored procedure is not

    I'm rather sure that d is true. But for the other 3. Please help.
    Sunday, October 21, 2012 3:27 PM

Answers

  • If you are asking which of these is false, my vote would be for b by process of elimination with the other three, but the answers are vague enough to leave room for debate.  Is this a sample test question from somewhere?

    a.  True - triggers don't take parameters, sp's do.
    b.  False - a trigger CAN contain application logic, but this is more of a design discussion as to whether you want to do this or not.  
    c.  True - a trigger can be explicitly fired by making a change/call to the object in which the trigger is associated, but is not explicitly called
    d.  True - a trigger can be associated with a table or view (but also to the server or database level).  A stored procedure can have dependencies on objects, such as a table or view, but is stored at the database level as opposed to the table/view level.

    Thanks,
    Sam Lester (MSFT)


    My Blog

    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

    • Marked as answer by azuki Monday, October 22, 2012 3:09 AM
    Sunday, October 21, 2012 4:08 PM