using insert where some values exist....

  • er  a pretty simple this one for you guys.. i want to add records to a table from another where they don't exists based on 2 fields..

    tables a and b both have fields sho and evi where sho and evi form the primary key for both.

     

    thus i want to update b with a but not where records of table a exist in table b.

     

    cheers in advance!

  • Insert into b (sho, evi, col1, col2)

    Select sho, evi, col1, col2 from dbo.a A where not exits (Select * from dbo.B B where A.sho = B.sho and A.evi = B.evi)

  • i can always rely on you remi ;-)))

  • If only that were true...

Viewing 4 posts - 1 through 3 (of 3 total)

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