IF EXISTS(SELECT * FROM table WHERE id1 = @id)
-- do the update because you know it exists
UPDATE Table SET field1 = @field1, etc.
-- do an insert, because it does not exist
INSERT INTO table ...
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)