title: How to execute Table valued function
body: <p>I have following function which returns Table .</p>
  
  <pre><code>create Function FN(@Str varchar(30))
    returns
    @Names table(name varchar(25))
    as 
    begin 
  
        while (charindex(',', @str) &gt; 0)
        begin
        insert into @Names values(substring(@str, 1, charindex(',', @str) - 1))
       set  @str = substring(@str, charindex(',', @str) + 1, 100)  
        end
        insert into @Names values(@str)  
  
        return
    end
  </code></pre>
  
  <p>Could any one please explain me how to run this function.</p>