The main Language Manipulation Language (DML) commands that have been used for many years are Update, Paste, and Delete. They do exactly what you expect: Insert adds new entries, Update modifies existing entries and Delete deletes entries.
The UPSERT statement modifies existing records; if there are no records, INSERTS writes new records. The functionality of the UPSERT statute can be achieved by two new sets of TSQL statements. These are two new
EXCEPT INTERSECT
With the exception of: -
Returns any single values ββfrom the query to the left of the EXCEPT operand that also do not return from the correct query
Intersect: - Returns any various values ββreturned by both the query to the left and to the right of the INTERSECT operand.
Example: - Suppose we have two tables, Table 1 and Table 2
Table_1 column name(Number, datatype int) ---------- 1 2 3 4 5 Table_2 column name(Number, datatype int) ---------- 1 2 5 SELECT * FROM TABLE_1 EXCEPT SELECT * FROM TABLE_2
will return 3.4, since it is present in table_1, and not in table_2
SELECT * FROM TABLE_1 INTERSECT SELECT * FROM TABLE_2
will return 1,2,5, since they are present in both tables Table_1 and Table_2.
All pains of complex joins are now eliminated :-)
To use this feature in SSIS, you need to add the Execute SQL task and place the code there.
source share