Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have an MS SQL Server Express edition, and i want to know if there were new products encoded in my application thru my database, or if user encoded new employees or change employee information. i want those changes stored in another table so i can easily see what are those and from which tables.

What I have tried:

i was thinking of creating a trigger for this but that would require me to add triggers to each tables. if there's a trigger for the changes in database?
Posted
Updated 8-Aug-16 19:49pm
Comments
Orcun Iyigun 8-Aug-16 2:46am    
You might consider looking up 3 SQL Server auditing features (Change Tracking, Change Data Capture and SQL Server Auditing)

Hi JOVY,

Please follow this lin explained about trigger for insert,update,delete in tables and you can find the sample table and script also.
Trigger-Insert,Update,Delete in tables


Thanks
:)
 
Share this answer
 
SQL
SELECT 
      [db_name] = d.name
    , [table_name] = SCHEMA_NAME(o.[schema_id]) + '.' + o.name
    , s.last_user_update
FROM sys.dm_db_index_usage_stats s
JOIN sys.databases d ON s.database_id = d.database_id
JOIN sys.objects o ON s.[object_id] = o.[object_id]
WHERE o.[type] = 'U'
    AND s.last_user_update IS NOT NULL
    AND s.last_user_update BETWEEN DATEADD(wk, -1, GETDATE()) AND GETDATE()
 
Share this answer
 

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