merge-using-cte-source code example
Example: merge-using-cte-source
CREATE TABLE #src (
a int NOT NULL,
b numeric(28, 8) NOT NULL,
PRIMARY KEY (a)
);
INSERT INTO #src VALUES (1, 1234.00), (3, 1340.00);
CREATE TABLE #tgt (
a int NOT NULL,
b numeric(28, 8) NOT NULL
PRIMARY KEY (a)
);
INSERT INTO #tgt VALUES (2, 1239.00), (3, 1345.00);
SELECT *
FROM #src AS src
FULL JOIN #tgt AS tgt ON
src.a=tgt.a;