I am trying to achieve such a command in my stored procedure as shown below. However, the setback is that "itemid" is an integer data type and i wish to store "1,2" data in "@ITEMID" parameter. Tried putting "@ITEMID VARCHAR(100)", but it does not work. Anyone know how i can work around this?
The error message is:
Syntax error converting the varchar value '1,3' to a column of data type int.
Code:
Select * from m.mstritem
where m.itemid not in (1,2)
Code:
Stored Procedure:
CREATE PROCEDURE [SEARCHSALEITEM]
(
@ITEMID VARCHAR(100)
)
As
SELECT *
FROM MSTRITEM M
WHERE (M.ITEMID=I.ITEMID)
AND (M.ITEMID NOT IN (@ITEMID))
GO
|