可能重複:
Select/Insert version of an Upsert: is there a design pattern for high concurrency?插入和更新在SQL Server一個查詢2005
我必須從一個表中插入數據到另一個條件的基礎上。
1.If Key is found update records
2.If key is not found insert the record.
我使用SQL Server 2005的所以不能用merge
聲明。請建議的替代方案來實現這一
建議的複製存儲過程的例子是「插入SELECT 「不是」插入/更新「 - 它絕對不是一個適當的重複鏈接。 – niico