I have to pass a list of integers as String from front end to a SQL Server database, e.g. : (2,3,4,5)
ALTER PROCEDURE GetMultipleCustomerByID
@Id nvarchar(50)
AS
BEGIN
SELECT
Firstname, Lastname
FROM
Customer
WHERE
CustomerID IN (@Id)
END
Exec GetMultipleCustomerByID "2,3,4,5"
Above represented values (2,3,4,5) are ID values (primary key) of the table.
From these id, I have to retrieve the rows from the table.
The string "2,3,4,5" may be dynamic. May include more than or less than 4 numbers.