title: Pass multiple parameters to sql function
body: <p>I have sql table with data as below </p>
  
  <pre><code>SnackID        Name
     1         Chicken
     2         Soda
     3         Chocolate 
     4         IceCream 
  </code></pre>
  
  <p>I have the below user-defined function which accepts arguments as a string with multiple values like 'Chicken', 'Soda'.</p>
  
  <pre><code>CREATE FUNCTION GetSnackCodes
  (
    @myValues varchar(max)
  )
  RETURNS @SnacksCodes TABLE 
  (
         mySnackCoded int NULL
  )
  AS
  BEGIN 
  
   insert into @SnacksCodes 
   select SnackID  from Snack where Name In (@myValues)
  
  return ;
  END;
  GO
  </code></pre>
  
  <p>When I tried to invoke this function by passing multiple values to this variable I am not getting expected result.
  I guess it's trying to search multiple (comma separated )values as a single value. </p>
  
  <p>Any other possible workaround for how to pass this values?</p>