0

I want to keep track of changes occur during execution a specific stored procedure like SP_Integration.

SP_Integration does update in many tables. I want to track the changes during integration in schema like:

TableName, ColumnName, OldValue, NewValue

If I go with trigger, it will keep track changes when it occurs outside of SP_Integration. I want to keep track changes of value when this stored procedure executes.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Habib Sheikh
  • 139
  • 1
  • 5
  • I take it you don't have control of SP_Integration. Otherwise just put the logging in the SP. – rheitzman Mar 17 '14 at 14:54
  • Side note: if you're using **SQL Server** you should **not** use the `sp_` prefix for your stored procedures. Microsoft has [reserved that prefix for its own use (see *Naming Stored Procedures*)](http://msdn.microsoft.com/en-us/library/ms190669%28v=sql.105%29.aspx), and you do run the risk of a name clash sometime in the future. [It's also bad for your stored procedure performance](http://www.sqlperformance.com/2012/10/t-sql-queries/sp_prefix). It's best to just simply avoid `sp_` and use something else as a prefix - or no prefix at all! – marc_s Mar 17 '14 at 14:56
  • possible duplicate of [best way to implement an audit trail in sql-server?](http://stackoverflow.com/questions/17546601/best-way-to-implement-an-audit-trail-in-sql-server) – JohnFx Mar 17 '14 at 15:10
  • This question may have a similar answer to what you are looking for: [link](http://stackoverflow.com/questions/14467961/how-to-get-the-stored-procedure-name-from-a-trigger-when-an-update-operation-was) – AHiggins Mar 17 '14 at 15:37
  • I dont want any trigger for this audit. i need CDC or some other solution – Habib Sheikh Mar 18 '14 at 19:51

0 Answers0