title: create function must be the only statement in the batch
body: <p>I'm getting this error from the function:</p>
  
  <pre><code>CREATE FUNCTION getLavel(@id int ,@lavel char)
  RETURNS date
  BEGIN
   DECLARE @date date
      select @date = (select authorization_date from Authorized WHERE diver_number = @id and @lavel =level_name)
      return @date
  END
  GO
  </code></pre>
  
  <p>What can be the reason?</p>
  
  <p>Ty very much.</p>