title: Can I return a varchar(max) from a stored procedure?
body: <p>VB.net web system with a SQL Server 2005 backend.  I've got a stored procedure that returns a varchar, and we're finally getting values that won't fit in a varchar(8000).</p>
  
  <p>I've changed the return parameter to a varchar(max), but how do I tell the OleDbParameter.Size Property to accept any amount of text?</p>
  
  <p>As a concrete example, the VB code that got the return parameter from the stored procedure used to look like:</p>
  
  <pre><code>objOutParam1 = objCommand.Parameters.Add("@RStr", OleDbType.varchar)
  objOutParam1.Size = 8000
  objOutParam1.Direction = ParameterDirection.Output
  </code></pre>
  
  <p>What can I make .Size to work with a (max)?</p>
  
  <p>Update:</p>
  
  <p>To answer some questions:</p>
  
  <p>For all intents and purposes, this text all needs to come out as one chunk.  (Changing that would take more structural work than I want to do - or am authorized for, really.)</p>
  
  <p>If I don't set a size, I get an error reading "String[6]: the Size property has an invalid size of 0."</p>