title: Len() vs datalength() in SQL Server 2005
body: <p>Recently I faced a issue when using <code>len()</code> in a query to find out the length of a query, <code>len()</code> was not counting the trailing spaces in the value. But <code>datalength()</code> is counting the trailing spaces also.</p>
  
  <p>Does this means that if I'm doing some operation which deals with the actual length of the value then I have to use <code>dalalength()</code> over <code>len()</code>.</p>
  
  <p>ex: If I need the value of a particular value to be is of 10 character length. i.e. If the value is 3 character length I've to append 7 spaces to it.</p>