• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

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
0
rocky050371
Asked:
rocky050371
  • 5
  • 3
  • 2
1 Solution
 
rocky050371Author Commented:
Can you dynamically create it?
0
 
rocky050371Author Commented:
Do you need to create one for each table?
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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:
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
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now