Hi,
I have a query that I would like to move into a stored procedure but I can't find the right syntax.
Query:
SELECT ID, DATANAME, DV
FROM table_name
WHERE (ID IN (39, 40, 69)) AND (DV= 1)
The value inside in varies, sometime it comes just one value, for example 39, and sometimes it may come several different numbers, it could reach more than 300 different ID's
This is the stored procedure I originally created but doesn't work:
CREATE PROCEDURE testingprocedure
(
@ID int, (int will not work for more than one ID)
@DV int
)
AS
SELECT
ID,
DATANAME,
DV
FROM
table_name
WHERE
(ID IN (@ID))
AND
DV = @DV
Any ideas will be eternally appreciated, thanks
I have a query that I would like to move into a stored procedure but I can't find the right syntax.
Query:
SELECT ID, DATANAME, DV
FROM table_name
WHERE (ID IN (39, 40, 69)) AND (DV= 1)
The value inside in varies, sometime it comes just one value, for example 39, and sometimes it may come several different numbers, it could reach more than 300 different ID's
This is the stored procedure I originally created but doesn't work:
CREATE PROCEDURE testingprocedure
(
@ID int, (int will not work for more than one ID)
@DV int
)
AS
SELECT
ID,
DATANAME,
DV
FROM
table_name
WHERE
(ID IN (@ID))
AND
DV = @DV
Any ideas will be eternally appreciated, thanks