I have a code like this:
IF EXISTS (SELECT * FROM table WHERE id = @id)
BEGIN
UPDATE table
SET stock = stock + @stock
WHERE id = @id
END
ELSE
BEGIN
INSERT INTO [table](
[id]
,[name]
,[stock])
VALUES(
@id
,@name
,@stock)
END
But, that code doesn't working. I was trace many times, there is no reason to be wrong. Can somebody help me?
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire