July 9, 2003 at 3:19 am
I have 2 tables.
Table A has existing records
Table B has new records to be updated into Table A.
However, I need to avoid duplication. What would be the best way to insert the data from table B into table A, but only if the data doesnt already exist in Table A. Is there a clause/function I can use?
Thanks
If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!
If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!
July 9, 2003 at 3:38 am
Please be carefull of duplicating posts. See/leave responses in http://www.sqlservercentral.com/forum/topic.asp?TOPIC_ID=13988&FORUM_ID=9&CAT_ID=1&Topic_Title=updating+data&Forum_Title=General
July 10, 2003 at 11:26 am
You can use a non-correlated sub query in the WHERE clause with a focus on the keys.
INSERT TABLE A
SELECT
FROM TABLE B
WHERE TABLE B KEY NOT IN (SELECT TABLE A KEY
FROM TABLE A)
Edited by - RonKyle on 07/10/2003 11:26:35 AM
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply