Updating data from 1 table to another table in continuos loop

  • Hello everybody !!!

    Thanks for all the help you have provided me all this time.

    I have been stucked in problem again. To tell you the truth i am not a programmer or DBA and i've very little knowledge of DBMS.

    Well i've 2 table. Table-A contains the old values and Table-B contains some New Values. Now want to update the Table-A from Table-B checking one by one record. As there is a PrimeryKey in both the Table.

    Table-a contains around 1200 records and 90 fields.

    Thats why its painfull to do the entry work again and again.

    Please help me

    Regards

    Neetal Shah

  • So you just want to copy all of your records from table b to table A?  If that's the idea have a go with this...

    INSERT INTO tableA

    --Make sure you change them to your actual column names

    SELECT col1col2col3 ... col90 

    FROM tableB  

    Or if you have some duplicate in B that you already have in a you'd need to make sure you only get the new records.  This can be done a number of ways, one of the simplest to explain is...

    INSERT INTO tableA A

    --Make sure you change them to your actual column names

    SELECT b.col1b.col2b.col3 ... b.col90 

    FROM tableB B

    WHERE tableB.col1 --or whatever your primary key column is

           NOT IN (SELECT DISTINCT col1 FROM tableA)  

    So you're inserting all rows from table b where the unique identified is not yet present in tableA

    To help us help you read this[/url]For better help with performance problems please read this[/url]

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

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