April 24, 2008 at 12:57 pm
A trigger runs in the context of the transaction that fires it. If the trigger fails the whole transaction fails and rolls back.
April 24, 2008 at 1:06 pm
Lynn,
I have a table say tblCustomer. I write trigger(AFTER UPDATE) on this table which inserts a record in another table,tblAudit . So you mean to say, the data updated in the customer table is commited only after the audit table is committed. In otherwords update to customer table and audit table are one transaction. Am I right?
Thanks for clarifying this. Appreciate it.
Kayal
April 25, 2008 at 1:36 pm
I found this trigger definietion in the internet, which helps..
A trigger is included as part of a single transaction with the statement that invokes it. Therefore, a rollback statement can be called from within the trigger and will roll back both the trigger and the data modification event. Also, if a severe error occurs, such as a user disconnect, SQL Server will automatically roll back the entire transaction.
Thanks everybody for all your suggestions on audit table. I will keep u posted. And it was wonderful how people help in this forum, it was my first experience in this forum and the help is amazing.
Thanks,
Kayal
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply