title: Return a varchar(max) from a stored procedure in SQL Server 2008
body: <p>I want to return a <code>varchar(max)</code> from a stored procedure in SQL Server 2008.</p>
  
  <p>So I tried:</p>
  
  <pre><code>alter proc SpSignup(
      @username varchar(max),
      @email varchar(max),
      @password varchar(max),
      @warning varchar(max) output)
  as
     if exists(select email from [login] where email=@email)
        return 'email already exists';
  
     insert into [login](username, email, password) 
     values(@username, @email, @password)
  </code></pre>
  
  <p>I want to return a <code>varchar</code> value (<code>'email already exists'</code>) if the email exists in the table, and don't want to give any <code>@warning</code> as parameter.</p>
  
  <p>But it shows that <code>@warning para is not supplying</code> after exec this proc</p>
  
  <blockquote>
    <p><em>Msg 201, Level 16, State 4, Procedure SpSignup, Line 0</em><br>
    <em>Procedure or function 'SpSignup' expects parameter '@warning', which was not supplied.</em></p>
  </blockquote>
  
  <p>and also it doesn't shows the output (<code>'email already exists'</code>)</p>