Created
May 16, 2011 14:08
-
-
Save FilipDeVos/974501 to your computer and use it in GitHub Desktop.
Thread Safe Insert/Update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE updatevalues(@id int, | |
@name varchar(20), | |
@amount numeric) | |
AS | |
IF EXISTS(SELECT * FROM updatetest WHERE id = @id) | |
BEGIN | |
UPDATE updatetest | |
SET name = @name, | |
amount= @amount | |
WHERE id = @id | |
END | |
ELSE | |
BEGIN | |
INSERT INTO updatetest VALUES (@id, @name, @amount) | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment