473,325 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

How can you track user actions in a table?

37
Hi,

How do you track the transactions of a user for a particular table using MSSQL? I once saw a script for this but I can't find it on anywhere on-line now.

So say I had a table called myTable, I would like to setup an INSERT trigger to populate a column in that table to insert the value of who actually performed the insert.

I know how to create an audit table to populate insert all the columns in the table to another via a trigger, but how to you acquire the name of the account that performed the transaction???

Any help is appreciated.

Thanks.
Dec 9 '06 #1
3 1869
almaz
168 Expert 100+
Here is a hint:
Expand|Select|Wrap|Line Numbers
  1. declare @table table (id int identity(1,1), insertedby nvarchar(100) default (SYSTEM_USER))
  2. insert @table default values
  3. insert @table default values
  4. insert @table default values
  5. insert @table default values
  6. insert @table default values
  7. insert @table default values
  8. select * from @table
Dec 11 '06 #2
Hello

The same I posted in Oracle, the user & the machine Id ??? But nobody responded in Oracle forum, Can any body help me too??? (IN ORACLE DB)

Regards
Reshmi
Dec 12 '06 #3
iburyak
1,017 Expert 512MB
Assume you have audit table mytable with columns
insert_user
insert_date
insert_value

Following syntax should be in your trigger:

[PHP]Insert into mytable(insert_user, insert_date, insert_value)
select suser_sname(), getdate(), inserted_value from inserted[/PHP]
Dec 12 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: LC | last post by:
hi, i worry about people doing something they shouldn't to my db and I would like to track any structural changes (who and which)to my db. I am using oracle 8.0.6.0.0 and 9.2.0.2.0. regards,...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
2
by: philip.mckee | last post by:
Hi Looking for some very general advice. I have a classic asp content management application which I am porting to ASP.NET. The database is SQL server, and it is hoped that we can leverage this...
15
by: l3vi | last post by:
I have a new system Im building that stores entries of what people are searching for on my sites. I want to be able to keep records of how many times a keyword was searched for daily, and from...
1
by: ummaria | last post by:
Hello everyone, I'm developing a web application using ASP.NET and VB.NET connected to a MS SQL Server. I want the system to automatically save user actions. For example, when a user logs...
0
by: Sharath | last post by:
Quality Globe is Glad to Offer you the Fast Track course on Automation, QTP Basics and Advanced, and Quality Center Starting Date: June 4th, 2007 Timings: 10 AM to 3:30 PM Duration: 50 Hours ...
0
by: Sharath | last post by:
"Inspired" by the huge success of our first two automation fast track batches We are forced to start third fast track automation batch ...
0
by: Sharath | last post by:
We are glad to inform you that "Inspired" by the huge success of our first three automation fast track batches We are forced to start fourth fast track automation batch ...
0
by: Sharath | last post by:
We are glad to inform you that "Inspired" by the huge success of our first four automation fast track batches We are forced to start fifth fast track automation batch ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.