Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7888435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:49:51+00:00 2026-06-03T05:49:51+00:00

I have a delete trigger on table A that deletes from table B. I

  • 0

I have a delete trigger on table A that deletes from table B. I am testing what happens when trigger fails, and for that purpose I renamed table B, so that trigger cannot find it.

These are my normal steps:

begin transaction
delete from C
delete from A -- this errors for reason mentioned
-- At this point the transaction is automatically rolled-back.

However if I do these steps:

begin transaction
delete from C
delete from B -- this errors for reason mentioned
-- At this point transaction is not rolled back, and I can still commit it.

How come in the first scenario, the transaction is rolling back? Shouldn’t it be up to application to call either rollback or commit?

And the whole difference is trigger failing vs. statement failing for same reason, I would expect the behavior to be identical.

edit to add example:

create table A (a int primary key)
create table B (a int primary key)
create table C (a int primary key)

create trigger Atrig on A for delete as delete B from B, deleted where  B.a=deleted.a

insert into A values(1)
insert into A values(2)
insert into B values(2)
insert into B values(3)

insert into C values(1)
insert into C values(2)
insert into C values(3)

Now rename table B to B2 (I used UI to rename it, so don’t have sql command to do so)

begin transaction
delete C where a=3
delete A where a = 2

Above returns this error, and rolls back transaction:

System.Data.OleDb.OleDbException (0x80040E37): [42000]
[Message Class: 16]
[Message State: 1]
[Transaction State: 0]
[Server Name: sybase_15_5_devrs1]
[Procedure Name: Atrig]
[Line Number: 1]
[Native Code: 208]
[ASEOLEDB]B not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).

However if I do this:

begin transaction
delete C where a=3
delete B where a = 2

above returns error, but transaction is not rolled back, and I can issue’commit transaction’:

System.Data.OleDb.OleDbException (0x80040E37): [42000]
[Message Class: 16]
[Message State: 1]
[Transaction State: 0]
[Server Name: sybase_15_5_devrs1]
[Native Code: 208]
[ASEOLEDB]B not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).

I’m thinking the behavior has something to do with this topic
In the table “Rollbacks caused by errors in data modification”, it says:

Context: Transaction only
Behavior: Current command is aborted. Previous commands are not rolled back, and subsequent commands are executed. 

Context: Trigger in a transaction
Behavior: Trigger completes, but trigger effects are rolled back.
All data modifications since the start of the transaction are rolled back. If a transaction spans multiple batches, the rollback affects all of those batches.
Any remaining commands in the batch are not executed. Processing resumes at the next batch.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:49:52+00:00Added an answer on June 3, 2026 at 5:49 am

    Context: Transaction only
    Behavior: Current command is aborted. Previous commands are not rolled back, and subsequent commands are executed.

    Context: Trigger in a transaction
    Behavior: Trigger completes, but trigger effects are rolled back.
    All data modifications since the start of the transaction are rolled back. If a transaction spans multiple batches, the rollback affects all of those batches.
    Any remaining commands in the batch are not executed. Processing resumes at the next batch.


    After reading the same manual that you specified in the answer this morning, I’ve tested in my sybase environment and that’s what happened.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a trigger in students table that deletes related records from other tables
I have a trigger for insert/update/delete. That is working fine. Also, I need the
I want to have an instead of delete trigger so that I can get
I have a table that has a Trigger associated with it for Update, Insert
I have a statement level trigger that fires whenever INSERT UPDATE or DELETE operations
i have a trigger running against a table that does not return a results
I erroneously delete all the rows from a MS SQL 2000 table that is
I have a trigger that executes a function on table insert or update. It
I have below trigger ALTER TRIGGER [dbo].[DeleteUserData] ON [dbo].[site_users] AFTER DELETE AS BEGIN SET
I have a stored procedure which is called inside a trigger on Insert/Update/Delete. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.