Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I need to insert data into auditrailtable for every insert/update/delete in sql server.I cannot use a trigger because i need to insert even loginid .so is there any other generic solution for this?

thanks in advance
Posted

Did you try inserting twice every time you do insert statements?

For ex:

SQL
INSERT INTO Table1(a,b,c) VALUES(1,2,3)

INSERT INTO AUDIT(log) VALUES(1)


Regards,
Eduard
 
Share this answer
 
v2
 
Share this answer
 
Comments
DepiyaReddy 8-Dec-11 17:13pm    
all my tables will not have userid column.i need to pass userid as parameter to the trigger .
thatraja 9-Dec-11 2:26am    
Why Trigger? You said that you didn't want to use that. See those links in my answer.
And you may pass the userid as parameter to the storedprocedure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900