I have to pass the multivalue parameter to a stored procedure. The datatype which is passing from C# code is string[]
.
This is my stored procedure
CREATE PROCEDURE spRecords
@Department VARCHAR(MAX) = NULL
AS
BEGIN
SELECT
ItemDetails,
Total,
Department
FROM
ItemRecords
WHERE
(Department.Name IN (@Department) OR @Department IS NULL)
END
I get the following error message
Cannot convert from string[] to string
I saw this stack overflow second answer to declare variable like @INFO_ARRAY ARRAY nvarchar(max)
. But I don't know how I should apply that in my case
Update
I don't want to change any code from C#. I am using one tool that will directly pass string[]
array parameter like datasource