Need help inserting records into tables

  • sfierce

    SSC Enthusiast

    Points: 121

    3 tables exist which have one field in common. During a bi-annual file import a program runs against the file and inserts new records into one table, but doesn't popluate the other two because they were created after the program was written. I don't know programming so I can't fix the program. I'm trying to write a sql script to look for any new records (which I can do based on one of the fields in the newly populated table) and then insert new records into the other two tables, only duplicating the ID in each to match the ID in the first table, and then add additional fields based on other criteria. Any help would be fantastic!

  • Antares686

    SSC Guru

    Points: 125444

    If you know how to write a SELECT query to get what you want then you just do an


    Just make sure you account for previous records their, something like


    FROM tbl1

    LEFT JOIN tbl2

    ON tbl1.PKID = tbl2.FKID


    will eliminate the items already in you table from being selected from tbl1.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply