Re: Session Variables and Triggers



How about grabbing the net_address of the current spid:

select spid, dbid, uid, sid, hostname, program_name, net_address
from master.dbo.sysprocesses (nolock)
where spid = @@spid


<MichaelJA@xxxxxxxxx> wrote in message
news:1151336882.355654.55530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm currently trying to create an auditing system for an existing
system. I would like to create triggers that will automatically track
changes within certain tables in my database but I wish to include the
user id of who is making the changes. Unfortunatly all users are using
the same db login information andseveral users may be accessing the db
at the same time, making SQL system variables useless. I thought about
making a table with session/user id variables, and using it to keep
track of the users, but i still have no way of specifying in a trigger
which users a transaction belongs to. Any suggestions?



.



Relevant Pages

  • Re: SPID question
    ... Transactional replication does not fire triggers. ... I am not sure if the context would be the same spid, ...
    (microsoft.public.sqlserver.replication)
  • a rookie question about sp_helptext
    ... My idea is to store triggers' creation codes in a seperate table using ... thread) is stored in table LOGINS where column USER= id of logged in user; ... a value @@SPID in LOGINS is being cleared. ...
    (microsoft.public.sqlserver.programming)
  • Session Variables and Triggers
    ... I'm currently trying to create an auditing system for an existing ... I would like to create triggers that will automatically track ... making SQL system variables useless. ...
    (microsoft.public.sqlserver.security)
  • Re: Session Variables and Triggers
    ... I would like to create triggers that will automatically track ... making SQL system variables useless. ... which users a transaction belongs to. ...
    (microsoft.public.sqlserver.security)
  • Re: Session Variables and Triggers
    ... system_user returns the current network login. ... I would like to create triggers that will automatically track ... making SQL system variables useless. ...
    (microsoft.public.sqlserver.security)