• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Copy table data from one server to another

Guest
Sep 10, 2015 Sep 10, 2015

Copy link to clipboard

Copied

Hi,

   I have two tables T1 and T2 of same structure at two different sql servers.T1 has 1,00,000 records and T2 has 99,000 records. Is it possible to copy

the extra records(1000 records) from table T1  to T2 which are not present in T2. Read about linked server. Is there any other alternative ways?

Thanks

TOPICS
Getting started

Views

508

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 10, 2015 Sep 10, 2015

Copy link to clipboard

Copied

LATEST

An idea comes to mind immediately. Backup your tables before you do anything. Then, whatever happens, you will be able to return them to their original state.

The idea goes as follows. Copy T1 to the server that has T2. On this server, do the following

INSERT INTO T2

SELECT T1.*

FROM T1

WHERE T1.PKCol NOT IN

    (SELECT T2.PKCol

     FROM T2)

The idea is straightforward. You use the primary key to get the 1000 records that are in T1 but not in T2, and insert them in T2.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation