title: How to create a user defined function in sybase?
body: <p>I trying to define a function in sybase. I write this script:</p>
  
  <pre><code>CREATE FUNCTION GetUserGroup (userId int)
  RETURNS int
  BEGIN
      RETURN (10)
  END
  </code></pre>
  
  <p>but when I run this, I get this error:</p>
  
  <pre><code>&gt;[Error] Script lines: 1-6 --------------------------
   Incorrect syntax near the keyword 'BEGIN'.
   Msg: 156, Level: 15, State: 2
   Server: NEWSERVER, Procedure: GetUserGroup, Line: 3 
  
  &gt;[Error] Script lines: 1-6 --------------------------
   A RETURN statement with a return status may only be used in a SQL stored procedure.
   Msg: 178, Level: 15, State: 1
   Server: NEWSERVER, Procedure: GetUserGroup, Line: 4 
  
   [Executed: 10/13/09 11:01:29 AM IRST ] [Execution: 0/ms] 
  </code></pre>
  
  <p>What can I do? 
  Thanks</p>