title: How to compare if two strings contain the same words in T-SQL for SQL Server 2008?
body: <p>When I compare two strings in SQL Server, there are couple of simple ways with <code>=</code> or <code>LIKE</code>.</p>
  
  <p>I want to redefine equality as:  </p>
  
  <p><em>If two strings contain the same words - no matter in what order - they are equal, otherwise they are not.</em></p>
  
  <p>For example:  </p>
  
  <ul>
  <li><code>'my word'</code> and <code>'word my'</code> are equal</li>
  <li><code>'my word'</code> and <code>'aaamy word'</code> are not</li>
  </ul>
  
  <p>What's the best simple solution for this problem?</p>