Script to copy data from one table into another

Version 2

    This is a script that we have used to pull data from one table in the database into another table, where certain data does not exist in the source table.


    In this example we are adding analysts to the analyst table where the user table shows them as an analyst although they are not in the analyst table.


    insert into tps_analyst (tps_guid)

    select tps_guid

    from tps_user

    where tps_user_type_guid = '9D3391F6-3235-4A88-A54C-6B322FB714CB'

    and tps_guid not in (select tps_guid from tps_analyst)



    Basically this will insert data into a table where the data is not in x table.