0

I found the issue, mine is sql server 2014

I have the below stored procedure. I want to pass multiple id's. How can I change the stored procedure to accept multiple id's

ALTER PROCEDURE [dbo].[GetProductsById] 
@id int
AS BEGIN

SET NOCOUNT ON;

SELECT * From Products
WHERE ProductId IN (@id)

END
Chatra
  • 2,989
  • 7
  • 40
  • 73

1 Answers1

2

In older versions of SQL server you can pass a CSV string and unpack it in the SP

For new versions of SQL Server you create a Table Parameter Variable in the server and pass this way.

If you are calling from something like C# you can set up a Data Table to pass the values