title: TSQL - If..Else statement inside Table-Valued Functions - cant go through
body: <p>Before posting I have read few articles about developing USD functions, but have not encountered solutions for my problem... which is as follows:</p>
  
  <p>I have a very simple database, which stores basketball players and consists of ID, Age, Height and Name column. What I would like to do is to implement a function 'height' with one parameter @set varchar(10), that depending one @set value will trigger off different select statements</p>
  
  <p>what I was trying to implement was in psuedo-code:</p>
  
  <pre><code>CREATE FUNCTION [dbo].[age](@set varchar(10))
  RETURNS TABLE
  AS
  BEGIN
  
      IF  (@set = 'tall')
           SELECT * from player where height &gt; 180
  
      ELSE IF (@set = 'average')
           SELECT * from player where height &gt;= 155 and height &lt;=175
  
      ELSE IF (@set = 'low')
           SELECT * from player where height &lt; 155
  END
  </code></pre>
  
  <p>Could anyone give me a hint how to implement it?</p>