triggers

Discussion in 'SQL Server' started by isa, Sep 27, 2006.

  1. isa

    isa New Member

    Joined:
    Sep 22, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hello everyone,

    i m using SqlServer 2000 and i have 2 tables :

    The 1st Table is : "UserActivityLog": (With following column names)
    SessionID
    UserActivityCode
    LogUserTypeID
    SystemUserID
    BuyerID
    SupplierID
    AccessInterfaceID
    CallerID
    IPAddress

    The 2nd Table is : "SessionOnline" (With following column names)
    StartDate
    LastActivityTime
    SessionID
    UserActivityCode
    LogUserTypeID
    SystemUserID
    BuyerID
    SupplierID
    AccessInterfaceID
    CallerID
    IPAddress

    now i want to write a Trigger (Before), After insertion in the first table the inserted values
    automatically goes to the 2nd table."SessionOnline" but for the specific SessionID.
    e.g. if i make some new insertion in table 1 and write sessionID =1 for 1st insertion after insertion , i make
    new insertion again in the table1 and for the same sessionID =1 then my 2nd table updates with the new
    one entry.

    As for 1st table i made 3 insertion for sessionID=1 then in my 2nd table the last inserted value goes to the 2nd
    table. (Each time my 2nd table Updated if i make new insertion for the same sessionID) coz in 2nd table
    for each sessionID i have only one entry in the 2nd Table "SessionOnline".


    plz reply me asap
    its very urgent.plzzzzzzzzz
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice