I am trying to use @@ROWCOUNT for an execute query in PetaPoco.
Problem is, it consider @@ROWCOUNT like "@ROWCOUNT" parameter because of the @.
Must declare the scalar variable "@ROWCOUNT".
Here is the execute query code
this.Execute(@"
UPDATE myTable
SET foo = @2
WHERE bar = @0
AND bor = @1
IF @@ROWCOUNT=0
INSERT INTO myTable
(bar, bor, foo)
VALUES
(@0, @1, @2)", myItem.bar
, myItem.bor
, myItem.foo);
I've searched to find if there was any specific syntax to use for PetaPoco SQL query, but I can't find any information about using @ for something else then parameters.
If there is no way to do it, is there any ways I can do an insert if the update item doesn't exist? (I'd rather avoid having to use a SELECT to see if the entry exist)