Click here to Skip to main content
15,893,790 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,
How i could take log or other things like that, When somebody delete a record of information from database(SQL-Server)and make another record manually.
Does SQL-Server records "was Deleted record" or another information in elsewhere?
Thanks and Regret
Posted

SQL
SELECT
    *
FROM
    fn_dblog(NULL, NULL) where operation ='LOP_DELETE_ROWS' and AllocUnitName like 'TableName%'


This will return the log of deleted rows on table. You can choose the column required
 
Share this answer
 
Comments
Elham.Deljooei 19-Feb-15 3:22am    
Hi my friend,
Thanks for your answer.
That works for deleting manually?
Praveen Tiwari 19-Feb-15 4:31am    
yes It works fine. try
Elham.Deljooei 19-Feb-15 23:17pm    
Hi,
I'm so sorry. I've had to say update instead of delete.
Could you help me?
Thanks and regret
SQL
SELECT
    *
FROM
    fn_dblog(NULL, NULL) where operation ='LOP_MODIFY_ROW' and AllocUnitName like 'TableName%'


This will return the update rows for the table
 
Share this answer
 
Comments
Elham.Deljooei 20-Feb-15 11:27am    
Hi my friend,
Thanks again for your attention and answer.
That woks but i want to get previous data "before was updated" and number of row and also date and time of update row.
Would you mind helping me?
Thanks and regret
Elham.Deljooei 21-Feb-15 4:28am    
please help me :(

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