title: Functions with returns 'table' has no begin...end?
body: <p>If I ever add 'Begin' after 'As' It says incorrect syntax. It works just fine If I'm trying to return one value though.</p>
  
  <p>Instead I should add 'return' after 'as' and open brackets ()</p>
  
  <p>Why is that?</p>
  
  <p><strong>With one value as returns, I can do it fine:</strong></p>
  
  <pre><code> CREATE FUNCTION MATHEE(@A int,@B int)
   returns int
   as 
   begin
      DECLARE @C int
  
      SET @C = @A + @B
  
   return @C 
   end
  </code></pre>
  
  <p><strong>With table as returns, I cant:</strong></p>
  
  <pre><code>   CREATE FUNCTION TOP_USERSs(@number int,@bob varchar(20))
  RETURNS TABLE 
  AS
  BEGIN
  
  RETURN SELECT agent from Agents where agent = @bob and prime &gt; @number
  END
  </code></pre>
  
  <p><strong>It says :</strong> </p>
  
  <blockquote>
    <p>Incorrect syntax near 'BEGIN'.</p>
  </blockquote>
  
  <p>It works fine using brackets and without begin..end though:</p>
  
  <pre><code>CREATE FUNCTION TOP_USERSs(@number int,@bob varchar(20))
  RETURNS TABLE 
  AS
  RETURN
  (
   SELECT agent from Agents where agent = @bob and prime &gt; @number
  )
  </code></pre>