title: Passing In Array Like Variables T-SQL
body: <p>I can someone help me turn this sql into a stored proc..</p>
  
  <pre><code>select * from voilets 
  where cfrw = 'F16'
  UNION 
  (select * 
  from voilets
  where cfrw in ('B05','B12','R02','F01','F16','F17','U11','U03','U04','U21')) 
  ORDER BY DSCA
  </code></pre>
  
  <p>Where 'F16 is a variable called @default 
  and
  <code>'B05','B12','R02','F01','F16','F17','U11','U03','U04','U21'</code> is an array of @voilets</p>
  
  <p>This is not working for me:</p>
  
  <pre><code>@sCarrierSelect varchar(max)
  AS
  BEGIN
  
  declare @SQL nvarchar(4000)
  
  set @SQL = '
  
  select * from voilets
  where t_cfrw =  ' + @default + '
  UNION 
  (select * 
  from carriers 
  where t_cfrw in (' + @voilets+')) 
  ORDER BY T_DSCA
  
  '
  print @SQL
  
  exec sp_executesql @SQL
  
  
  END
  </code></pre>