title: T-SQL (varchar(max) vs CLR (string, SqlString, SqlChars)?
body: <p>I have a problem, that I can't solve. I'm using SQL Server 2005, C# CLR for using outer dll. The problem is at length of parameter. I need to use as function parameter type <code>varchar(max)</code>. If at C# code I use <code>string</code>, <code>SqlSring</code>, I can't use T-SQL type <code>varchar(max)</code>, just <code>varchar(4000)</code> of <code>nvarchar(4000)</code>. I need to say, that can be situations, when I need to use more then 4000 symbols, so I need know, what C# type I need to use for <code>varchar(max)</code>.</p>
  
  <p>I have read a lot of articles, and several of them say, that for this I can use <code>SqlChars</code>. But! I have manipulations with strings. How can I have actions with <code>string</code> or <code>SqlString</code> and then convert to <code>SqlChars</code>? (It is possible <code>SqlChars.ToString()</code> or <code>SqlChars.ToSqlString()</code>).</p>
  
  <p>I didn't find any C# code for this.</p>