Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
8022421
Starting Member
45 Posts |
Posted - 2010-09-20 : 03:08:00
|
Iam deleting a record from a table which has 8 columns. At this time, I need to capture this record in the Delete Audit table which has 10 columns. Iam writing a trigger for this purpose. Out of these 10 columns, I can get the values of 8 columns. But the remaining 2 column values need to be passed from the front-end. Is there any way I can pass the values from the front-end to the trigger. |
|
PavanKK
Starting Member
32 Posts |
Posted - 2010-09-20 : 03:26:05
|
Instead of writing a trigger you can use OUTPUT INTO clause to insert those values directly from DELETE statement into Audit table. Check BOL for OUTPUT syntaxKK |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-09-21 : 12:24:10
|
what are those fields actually? didnt understand what extra information you're trying to add to audit?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
X002548
Not Just a Number
15586 Posts |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2010-09-21 : 13:05:02
|
You'll need to add those two columns to the table.________________________________________________If it is not practically useful, then it is practically useless.________________________________________________ |
 |
|
Kristen
Test
22859 Posts |
Posted - 2010-09-21 : 13:07:31
|
I don't like this idea, but mention it in case of any benefit.Create a VIEW that has the normal columns, plus the two extra columns, insert into that, and then create an INSTEAD OF trigger on the View.We used INSTEAD OF triggers on Views for a while, but got fed up with the limitations and workaround that were needed (like problems when the underlying table included COMPUTED columns and so on) that we gave up on them ... hence why I wouldn't start with this ... but it might just solve this particular problem |
 |
|
|
|
|