I have a really odd scenario that I can't seem to find a solution to (unless it's that basic!).
It has to do with a hyphen in the value being passed to a stored procedure that's doing an UPDATE.
The procedure is of the form:
This WORKS if the value of @item does NOT contain a hyphen/dash. However, when I pass a value to @item with a dash, say "ABC-1", the response from the server is that the 'query executed successfully'; I do not get the message '1 row affected by last query' as I should. Now, if I execute the command directly (not via the stored proc), it works fine.
Possibly even stranger, is that I can pass an item number with a dash when the stored proc is doing a SELECT. In other words, this
works just fine with a hyphen in the value for @item.
I'm puzzled! Any thoughts?
Jeff
It has to do with a hyphen in the value being passed to a stored procedure that's doing an UPDATE.
The procedure is of the form:
Code:
UPDATE tblItem SET NextNumber = @num WHERE (ItemNumber = @item)
This WORKS if the value of @item does NOT contain a hyphen/dash. However, when I pass a value to @item with a dash, say "ABC-1", the response from the server is that the 'query executed successfully'; I do not get the message '1 row affected by last query' as I should. Now, if I execute the command directly (not via the stored proc), it works fine.
Possibly even stranger, is that I can pass an item number with a dash when the stored proc is doing a SELECT. In other words, this
Code:
SELECT .... WHERE (ItemNumber=@item)
works just fine with a hyphen in the value for @item.
I'm puzzled! Any thoughts?
Jeff