341129 visitors has seen the Tim-Carter.com site. Thanks!
364 visitors has seen the Tim-Carter.com site today.
 
 
Search :  
 
>>> Programming >> MSSQL > How To Copy Some Data From One Table To Another Only If It Does Not Exist In The Destination Table? (This page has been seen 623 times)

How To Copy Some Data From One Table To Another Only If It Does Not Exist In The Destination Table?

Lets say you hae a table Called Products, and you have another table called Products2, And you want to copy some data From Products2 table, to Products table, but only if the data From Products2, doesnt exist in Products.

INSERT INTO Products (Item,ProductName,Rate)
SELECT Item,Description,Price FROM Products2 WHERE Item NOT IN (SELECT Item From Products)




Like
 
Dislike


Keywords for this article:
COPY FROM ONE TABLE TO ANOTHER || ONLY COPY IF NOT EXIST

Post comment

Name:


Comment:

Code Language:

Code:

Here you can paste a code example. It will then be processed by SyntaxHighlighter and formatted for easier readability.
Please remember to select the correct Code Language in the select above so the SyntaxHighlighter can highlight the code properly.




Code:

Please enter the code you see above

What is 2 + 8 =

Submit Comment


No one has commented on this page yet. You could be the first.


Advertisement by Google