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 4622930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:54:47+00:00 2026-05-22T02:54:47+00:00

I have the same local and remote databases structure and I connect to remote

  • 0

I have the same local and remote databases structure and I connect to remote database using
linked server.
my local database is SQL2000 and remote one is SQL2008
My local table:

tbl_name
Id       Name         flag
1      Raymond         1
2      Sara            1
3      Souzan          2

My Remote table

tbl_name
Id       Name

Now I want to insert every record with falg field value=1 into remote table and then delete the inserted records in local database.

    create proc TransferInsertedRecords
    as
    begin
        create temp @table
        (
          id int,
          name nvarchar(10)
        )
        insert into @temp 
            select id,name from tbl_name
                   where flag=1
        Insert into RemoteServer.dbo.Worker.tbl_Names.name
        values select name from @temp

        delete from t1
                from tbl_name t1
                     inner join @temp t2
                           on t1.id=t2.id and flag=1
end

I have a job that runs this procedure every 5 minutes.
How can I be sure every inserted record in remote database will delete in local database?
My mean is about connection lose. suppose some data is inserted in remote database but before inserting the rest of data and deleting them in local database the connection lose.

Should I use DISTRIBUTED TRANSACTION if so where should I put COMMIT TRANSACTION or ROLLBACk statements.

  • 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-22T02:54:48+00:00Added an answer on May 22, 2026 at 2:54 am

    Yes, use DISTRIBUTED TRANSACTION, that’s the only way you can ensure your changes will work.

    DISTRIBUTED TRANSACTION should be able to handle connection failure, in which case you will detect the error and rollback.

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

Sidebar

Related Questions

I have a local database used for development and testing purpose and one remote
I am trying to connect to my mysql database on a remote server (via
Using C# (vs2005) I need to copy a table from one database to another.
I have two databases I need to work with, one oracle on a remote
I have rake tasks for getting the production database from the remote server, etc.
I have a server attempting to connect to a MySQL database hosted outside of
Is it possible to have same table name on different schema with different data
Assume I have the following style table, col1 col2 and col3 have same value
I have the same problem as described in ( Last record of Join table
If I have a SQL Server 2008 database that uses FILESTREAM and stores 10

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.