title: Creating a SQL-Server function which turns negative numbers into null
body: <p>In SQL-Server am trying to create a function which turns negative values (int) into nulls/zero's.
  However the ways it is now all the numbers (also the positive ones) get turned into zero.</p>
  <pre><code>create FUNCTION planning.FN_test_return_zero_incaseof_negative_value (@value as int)
  
  RETURNS int
  
  BEGIN
      if @value &lt; 0 return 0
      DECLARE @days as int
  
  
  RETURN @days
  END
  GO
  </code></pre>