SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MS SQL Triggers: how many tranasactions could i have ?

    hello,
    I would like to know how many transactions you can have in a trigger and how many if statements could be nested in a trigger ?

    e.g.

    if @@error = 0
    -- transaction 1
    begin
    --statements go here
    end
    else goto option1


    -- transaction 2
    if @@error <> '0'
    begin
    --statements go here
    end
    else goto option2

    option1:
    --statments

    option2:
    insert into error_table (msg)
    values (@@error)

    Would a trigger like this be ok ?



    Afrika

  2. #2
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    700
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    I don't see what you mean by many transactions. The code within a trigger is executed within the same transaction as the statement that caused the trigger to be executed. Are you thinking of nested or parallel transactions or what?

    In general, it seems to me you are putting to much application logic into triggers.


Bookmarks

Posting Permissions

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