Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I want to identify the DML(Insert, update, delete) changes in a database along with the records in a particular table modified in SQL database.

I came accross Change Data Capture but in that way I cannot find the records modified.

Pls help.

Regards,
DhivyaJ
Posted

There is very Good Functionality in sql to do the task.
TRIGGER.

Here is Good Article from codeproject...
Triggers -- Sql Server[^]

And Here is very good video for Triggers with practical examples.
http://www.youtube.com/watch?v=JNb54seLzZY[^]

Hope This Help You.
---------------------
Pratik Bhuva
 
Share this answer
 
If you want row data then you can go for trigger. inside sql server you can find new/deleted/modifed records.

inside trigger you find 2 special tables named INSERTED and DELETED. SQL server automatically create and mange both tables and both have same structure.

From that tables you can collect old/deleted and new row.

http://stackoverflow.com/questions/3336319/using-inserted-and-deleted-tables-in-the-triggers[^]
 
Share this answer
 
Comments
Dhivya.J 4-Nov-13 3:37am    
Thank you. Is the trigger you mentioned are table and record specific?
Dhivya.J 4-Nov-13 3:38am    
I have nearly 600 tables in one DB and my SQL contains 3 databases like this. Is it possible to use trigger in this case?
S. M. Ahasan Habib 4-Nov-13 4:04am    
Yes it is possible but that type of huge triggers management might be difficult and create maintenance overhead. My suggestion is try to do it from your application logic/business logic layer with proper object oriented programming. It will help you to keep simple to your databases.

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