• Sean Lange (8/27/2013)


    vignesh.ms (8/26/2013)


    hi SSCrazy Eights,

    I have 2 table say source and destination.

    I'm trying to insert data from source table to destination table ,which are not available in the destination table.

    this is the requirement, suggest me the best possible way.

    Thanks many..

    Your description is not very clear. It sounds like a good candidate for the MERGE statement (which you said you used in your original post).

    Hi Sean Lange,

    Forgot about the query and all that I have shared already...

    create table SourceTable

    (number int)

    create table DestinationTable

    (number int)

    insert into SourceTable values(1)

    insert into SourceTable values(2)

    insert into SourceTable values(3)

    insert into SourceTable values(4)

    insert into SourceTable values(5)

    insert into SourceTable values(6)

    insert into DestinationTable values(1)

    insert into DestinationTable values(2)

    insert into DestinationTable values(3)

    In the above sample, sourcetable contain values 1,2,3,4,5,6

    And Destinationtable contains 1,2,3

    I need a query to insert 4,5,6 alone from source table .

    (ie) query should check whether the upcoming data is already there or not. if not insert else skip.

    note : both tables are too huge. please suggest me best way to achieve the goal

    hope now you could understand my requirement.

    Thanks