Results 1 to 3 of 3

Thread: Transfer Data

  1. #1
    Join Date
    Oct 2004
    Posts
    15

    Transfer Data

    Hello Forum.
    Do you know if there is a way to do the following with SQL Server or with some Software:

    .I want to transfer data between 2 tables of different databases(table A in database X and table A in database Y),these tables have the same structure. The data that I want transfer are the one that are in table A database X and are not present in table A database Y.
    When I use DTS I use the option "Append the Data" but if some row are in both table the DTS fail with an error of "primary key Violation".

    My objective is transfer the data that are in table A database X and are not present in table A database Y and keep the data in table A database Y.

    Thanks in advance,
    Erik

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Are both databases in the same server?. In that case you can simply write an INSERT statement like

    INSERT INTO y..tableA
    SELECT A.*
    FROM X..TableA as A
    WHERE A.PK not in
    (SELECT B.PK
    FROM Y..TableA as B)

    If the databases are in different server, you can create a linked server and modify the insert statement.

  3. #3
    Join Date
    Feb 2003
    Posts
    1,048
    You can also transfer over the data to a new table and then run the query to update the data in the real table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •