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 |
kinqberq
Starting Member
2 Posts |
Posted - 2012-04-11 : 10:42:36
|
Hi.Can someone tell me if it is possible to execute a trigger after a transaction has been committed on a table, rather than after UPDATE or INSERT?I have a transaction that inserts a record for Card table, then inserts a record that has a link with another table called CardProperties.The problem is, I need to access both the Card data and the CardProperties data inside the after insert trigger, but if the trigger is an AFTER INSERT trigger on the Card table it fires before the CardProperties association record has been inserted and so it is not available.I can't reach the CardProperties because of transaction. Any idea for that ?-------------------------------------------------------------------TABLE 1 => CL_CARD TABLE 2 => CL_CARD_PROPERTIESFor insert or update there is a transaction in CL_CARD ( I guess )and it creates a record both tables.I created an after insert trigger in CL_CARDthen I can get id from inserted(CL_CARD) but I can not access CL_CARD_PROPERTIES columns because of transaction? |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-04-11 : 11:11:47
|
Maybe it is better to tell us the problem you want to solve this way? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
kinqberq
Starting Member
2 Posts |
Posted - 2012-04-11 : 12:36:53
|
I have developed a web application with c#, .net 2010 and sql server 2008 R2. Some of data should come from another application.( accounting program : it is bought from a company and program is using sql server 2005) I restore my app's database to server that is used for accounting program. In a server there are 2 databases. One of them is mine and the other is accounting program's. The account card is related with too many tables. One of them is tbl.card_properties and the main table is tbl.card. When a new record is inserted to accounting program, I want to add these records to my database. I thougt that I should create a "after insert trigger" to accounting program's db tbl.card. I learned that insertion of data to the tbl.card is using transaction. I can get inserted fields from tbl.card but I can't get fields of tbl.cardproperties . I assume that it is because of transaction. |
 |
|
|
|
|