title: Error "incorrect syntax near if,then,else" please correct
body: <p>i am creating a function to calculate interest . dbo.days1() is a function which gives no of days</p>
  
  <pre><code>CREATE FUNCTION dbo.int1
      (
  
      )
  
  RETURNS int
  as
  begin
  declare @days int
  
  set @days = dbo.days1()
  if @days &gt; 0 
  then
  return( select((((dbo.delivery.roi * dbo.delivery.adv1)/100)/365)*@days)from delivery)
      else
      return (0)
       end if      
      END
  </code></pre>
  
  <p>it gives me syntax error near if then and else.how to correct</p>