title: How do I compare a value to an ntext column?
body: <p>I am working on a project in which i am saving pdf 's text extracted by itextsharp in a column of sql server database.For some requirements i have to search document by giving document text as a parameter to a procedure to find the document.My code is</p>
  
  <pre><code>   @docText varchar(8000)
  
     select * from document d
  
     where convert(varchar(8000),d.text) = @docText
  </code></pre>
  
  <p>Problem is that when document text size is less then 8000 (for example 2600 )then it is not matched by this query and in above query we can not set size as convert(varchar(len(@docText)),d.text).</p>
  
  <p>How to set column (text) size equal to parameter size dynamically passed to the procedure.</p>