What process fired a Trigger?

  • Hi, I am new here and hope someone may be able to help me. I have created an Insert Update Delete trigger on a table which is working fine. However as more than one person can be updating said table at a time I was wondering if there is a way of knowing which SQL process ID updated the table and thus caused the trigger to fire? So i can then log the user who updated the table.

    Thanks in anticipation.

  • @@spid will give you that.

    user_name() might be more useful, depending on the connection context.

    Books Online has data on each of these and what they do.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Great thanks it worked.

    Helped me out no end.:):)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply