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

  • Home
  • SEARCH
  • 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 217531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:39:58+00:00 2026-05-11T18:39:58+00:00

I wrote a trigger that updates local table and similar table on linked server.

  • 0

I wrote a trigger that updates local table and similar table on linked server.


CREATE TRIGGER myTtableUpdate ON myTable
AFTER UPDATE
AS
IF (COLUMNS_UPDATED() > 0)
BEGIN
DECLARE @retval int;
BEGIN TRY
EXEC @retval = sys.sp_testlinkedserver N'my_linked_server';
END TRY
BEGIN CATCH
SET @retval = sign(@@error);
END CATCH;

IF (@retval = 0)
BEGIN
UPDATE remoteTable SET remoteTable.datafield = i.datafield
FROM my_linked_server.remote_database.dbo.myTable remoteTable
INNER JOIN inserted i ON (remoteTable.id = i.id)
END
END -- end of trigger

Unfortunately when connection is down I get error message
‘Msg 3616, Level 16, State 1, Line 2’
‘Transaction doomed in trigger. Batch has been aborted’
and locally made update is rolled back.

Is there a way to maintain this error and keep local updates?
Note that I’m using SQL Server 2005 Express Edition on both PCs running Windows XP Pro.

edit1: SQL server is Express Edition
edit2: Both PCs run Windows XP Pro so these aren’t servers

  • 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-05-11T18:39:58+00:00Added an answer on May 11, 2026 at 6:39 pm

    don’t write to the remote server in the trigger.

    • create a local table to store rows that need to be pushed to the remote server
    • insert into this new local table in the trigger
    • create a job that runs every N minutes to insert from this local table into remote server.

    this job can run a procedure that can test for the connection, and when it is back up, it will handle all rows in the new local table. It can process the rows in the local table this way:

    declare @OutputTable table (RowID int not null)
    
    insert into my_linked_server.remote_database.dbo.myTable remoteTable(...columns...)
        OUTPUT INSERTED.RowID
        INTO @OutputTable
        SELECT ...columns...
            from NewLocalTable
    
    delete NewLocalTable
       from NewLocalTable           n
           inner join @OutputTable  o ON n.RowID=o.RowID
    

    EDIT based OP comment
    after inserting into this new local table start the job from the trigger (sp_start_job), it will run in its own scope. If you can’t use sql server jobs, use xp_cmdshell to execute the stored procedure (lookup SQLCMD or ISQL or OSQL, I’m not sure what you have). still schedule the job every N minutes, so it will eventually run when the connection comes up.

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

Sidebar

Ask A Question

Stats

  • Questions 139k
  • Answers 139k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer it will be the user permissions. while the apache (or… May 12, 2026 at 7:41 am
  • Editorial Team
    Editorial Team added an answer This page seems to answer your question: Adding Certificates to… May 12, 2026 at 7:41 am
  • Editorial Team
    Editorial Team added an answer Update: PyPi is now powered by Warehouse, which is the… May 12, 2026 at 7:41 am

Related Questions

I was trying out attached properties and style triggers hoping to learn more about
I have an Ajax form that updates a div when submitted with a submit
I have a number of tables that use the trigger/sequence column to simulate auto_increment
I need an accurate timer to interface a Windows application to a piece of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.