triggers

isa's Avatar
isa
Newbie Member
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
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Refer to Audit Trail in SQL Server 2000 or SQL Server 7. It creates a trigger for update and delete but it shall gets you moving for the inserts as well.