title: T-SQL: pass an array of ids to a stored procedures
body: <p>I'm trying to send and array of parameters to a stored procedure</p>
  
  <pre><code>SELECT [id_Curso] AS IDCurso
    ,[Cod_Estabelecimento] AS CodEstabelecimento
    ,[Des_Estabelecimento] AS DesEstabelecimento
    ,[Cod_Curso] AS CodCurso
    ,[Des_Curso] AS DescCurso
    ,[Cod_Grau] AS CodGrau
    ,[Des_Grau] AS DescGrau
    ,[Cod_Area_Educacao] AS CodAreaEducacao
    FROM [BEP_DEV].[dbo].[Curso]
    where [Cod_Area_Educacao] in @List
  
  DECLARE @List VARCHAR(MAX);
  SELECT @List = '(1,2,3,4)';
  
  SELECT [id_Curso] AS IDCurso
    ,[Cod_Estabelecimento] AS CodEstabelecimento
    ,[Des_Estabelecimento] AS DesEstabelecimento
    ,[Cod_Curso] AS CodCurso
    ,[Des_Curso] AS DescCurso
    ,[Cod_Grau] AS CodGrau
    ,[Des_Grau] AS DescGrau
    ,[Cod_Area_Educacao] AS CodAreaEducacao
    FROM [BEP_DEV].[dbo].[Curso]
  where [Cod_Area_Educacao] in (1,2,3,4)
  </code></pre>
  
  <p>How can I transform the first case in something like the 2nd one (which works.)? </p>
  
  <p>I tried also with xml but also can't make it work.</p>
  
  <p>Any help?</p>