none
Assistance with script

    Question

  • I have inherited a database that has been modified beyond its original scope. My question is that I have a table that includes all the employees and photos and other pertinent data. Instead of using this table someone created another with basically the same information and has tied other application to the newly created one. This table is not updated as it is not part of the original software. My question is what script could I run to move any data that is in the updated table to the other table. I was able to create the below script to see the number of records that do not exist in the other table. How can I insert that missing data into the other table?Thanks. 

    SELECT Last_Name,
      First_Name,
      SSN
    FROM db_ddladmin.Employees
    LEFT JOIN db_ddladmin.A_0D8E0C76_ED1E_41B2_9ADE_B29A60FB59AD 
    ON db_ddladmin.Employees.SSN = db_ddladmin.A_0D8E0C76_ED1E_41B2_9ADE_B29A60FB59AD.AF_SSN
    WHERE db_ddladmin.A_0D8E0C76_ED1E_41B2_9ADE_B29A60FB59AD.AF_SSN IS NULL

    Thursday, June 16, 2016 6:01 PM

All replies

  • And everything is in the db_ddladmin schema? Yikes!

    Not sure that I understand the question. With the information you have given, you should just to

    INSERT db_ddladmin.A_0D8E0C76_ED1E_41B2_9ADE_B29A60FB59AD 
       (Last_Name, First_Name, SSN)
    <your SELECT goes here>

    But if it was that simple, why would you ask? And I doubt that it is that simple. There are likely to be differences between the table, not the least with people that are in both databases, but have conflicting information.

    But as you give no information about this, I cannot give any further recommendations.

    Thursday, June 16, 2016 9:05 PM