You may have heard the UPSERT functionality in sql statements. In short an upsert statements UPDATEs records if they are existing in the table or in the selected row set else INSERTs records to the table as new rows within a single sql command.
You may also read or heard about the UPSERT functionality will be available with the new SQL Server edition SQL Server 2005 (aka YUKON)
It is true that this functionality has existed in the beta versions of the SQL Server 2005 with the name "Insert with Merge" and in the syntax of MERGE INTO. The syntax is also has been explained with samples on some books but in the RTM version of the SQL Server 2005 this command is also removed.
So do not bother yourself if you are trying to run the command
MERGE INTO MyTable
USING MyTempTable
ON MyTempTable.MatchingField1 = MyTable.MatchingField1
WHEN MATCHED THEN
UPDATE UpdateField1 = MyTempTable.UpdateField1
WHEN NOT MATCHED THEN
INSERT VALUES(MyTempTable.MatchingField1, MyTempTable.UpdateField1)
and getting the error message
Incorrect syntax near the keyword 'INTO'.
If you are using the INTERSECT or EXCEPT in such queries shown below,
UPDATE CustomersA FROM (CustomersB INTERSECT CustomersA)
go
INSERT INTO CustomersA FROM (CustomersB EXCEPT CustomersA)
go
You will still fail with the error message
Incorrect syntax near the keyword 'FROM'.
Instead you can still run 2 queries to get the same upsert functionality, first run an update command for the rows that exist in both record sets or tables then an insert command for the records that does not exist in the target row set or the table.
UPDATE CustomersA
SET CustomerName = B.CustomerName
FROM CustomersA A (NoLock)
INNER JOIN CustomersB B (NoLock) ON A.CustomerId = B.CustomerId
And later run the Insert command
INSERT INTO CustomersA (
CustomerId,
CustomerName
)
SELECT
Id,
Name
FROM CustomersB (NoLock)
WHERE
Id NOT IN (
SELECT CustomerId FROM CustomersA (NoLock)
)