Reacting to a SQL Trigger

Is there a way of plugging into a MS SQL Server trigger, what I mean is when a record changes my .net program needs to respond accordingly.

i.e the user wants to know the new / old values of a changed record
rocky050371Asked:
Who is Participating?
 
Anthony PerkinsCommented:
The only way you should use a TRIGGER is to log the changes in a table.  You can then run a job periodically to retrieve these values.
0
 
rocky050371Author Commented:
Can you dynamically create it?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
rocky050371Author Commented:
Do you need to create one for each table?
0
 
CodeCruiserCommented:
It has to be created for each table and if by dynamically you mean in code then yes.
0
 
rocky050371Author Commented:
SQL dependency does not return the changed data
0
 
CodeCruiserCommented:
It tells you that data has changed. You then have to find out yourself.
0
 
rocky050371Author Commented:
Ok I will look at an alternate way as that seems extremely long winded.
0
 
Anthony PerkinsCommented:
On second thoughts you do not even need a TRIGGER for this.  You can use the OUTPUT clause in your INSERT/UPDATE/DELETE statement to retrieve the original and new values.
0
 
rocky050371Author Commented:
They key here is being informed via a separate program when data changes (user defined)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.