title: Table type parameter in a stored procedure cause operand type clash error
body: <p>I want to give an array of identifiers as argument to a stored procedure.</p>
  
  <p>The stored procedure looks like :</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[SearchPerson]
      @personType INT = NULL,
      @city NVARCHAR(64) = NULL,
      @siteIds IntegerList READONLY,
      -- some other params...
  AS
      SELECT
          -- some fields...
      FROM dbo.PersonView AS pv
      WHERE
      (
          (@personType IS NULL OR pv.PersonType = @personType) AND
          (@city IS NULL OR pv.City LIKE '%' + @city + '%') AND
          (pv.SiteId in (SELECT si.Value FROM @siteIds AS si)) AND
          -- some other params filter...
      )
  </code></pre>
  
  <p>The user table type looks like :</p>
  
  <pre><code>CREATE TYPE [dbo].[IntegerList] AS TABLE(
      [Value] [int] NULL
  )
  </code></pre>
  
  <p>When I call the stored procedure from a script in SSMS (I originally have the same problem calling it from .NET code) :</p>
  
  <pre><code>DECLARE @siteIds AS IntegerList,
  @personType AS INT = 1
  INSERT INTO @siteIds VALUES (1)
  EXEC [dbo].[SearchPerson] @personType, @siteIds
  </code></pre>
  
  <p>I got the error :</p>
  
  <blockquote>
    <p>Operand type clash: int is incompatible with IntegerList</p>
  </blockquote>