Home
Manage Your Code
Snippet: If Exists Update Else Insert (SQL)
Title: If Exists Update Else Insert Language: SQL
Description: If Exists Update Else Insert Views: 1043
Author: Peter Parker Date Added: 4/7/2008
Copy Code  
UPDATE Table1 SET (...) WHERE Column1='SomeValue'
IF @@ROWCOUNT=0
    INSERT INTO Table1 VALUES (...)
Notes
http://blogs.msdn.com/miah/archive/2008/02/17/sql-if-exists-update-else-insert.aspx