title: Can we use operator in function?
body: <p>Why using operator is not working for me in the function?</p>
  
  <pre><code>IF OBJECT_ID('Sales.fn_FilteredExtension','IF') IS NOT NULL DROP FUNCTION Sales.fn_FilteredExtension;
  GO
  
  CREATE FUNCTION Sales.fn_FilteredExtension
  (
      @lowqty smallint,
      @highqty smallint
  )
  RETURNS TABLE AS RETURN
  (
      SELECT unitprice,qty
             FROM Sales.OrderDetails where (qty &lt;= @highqty) AND (qty &gt;= @lowqty)
  );
  GO
  </code></pre>
  
  <p>When I run </p>
  
  <pre><code>SELECT * FROM Sales.fn_FilteredExtension(20,15)
  </code></pre>
  
  <p>I get blank results but when I use </p>
  
  <pre><code>IF OBJECT_ID('Sales.fn_FilteredExtension','IF') IS NOT NULL DROP FUNCTION Sales.fn_FilteredExtension;
  GO
  
  CREATE FUNCTION Sales.fn_FilteredExtension
  (
      @lowqty smallint,
      @highqty smallint
  )
  RETURNS TABLE AS RETURN
  (
      SELECT unitprice,qty
             FROM Sales.OrderDetails where qty BETWEEN @highqty AND @lowqty
  );
  GO
  </code></pre>
  
  <p>I get the output. What's the difference ?</p>