title: How to pass array parameter to stored procedure in my case without changing C# code?
body: <p>I have to pass the multivalue parameter to a stored procedure. The datatype which is passing from C# code is <code>string[]</code>.</p>
  
  <p>This is my stored procedure</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I get the following error message</p>
  
  <blockquote>
    <p>Cannot convert from string[] to string</p>
  </blockquote>
  
  <p>I saw this <a href="https://stackoverflow.com/questions/24636669/passing-array-to-a-sql-server-stored-procedure?lq=1">stack overflow</a> second answer to declare variable like <code>@INFO_ARRAY ARRAY nvarchar(max)</code>. But I don't know how I should apply that in my case</p>
  
  <p><strong>Update</strong></p>
  
  <p>I don't want to change any code from C#. I am using one tool that will directly pass <code>string[]</code> array parameter like datasource</p>