title: How to use char index in dynamic sql
body: <p>As I am new to dynamic SQL, can you please help me with the below query?</p>
  
  <pre><code>((LEFT(UF.PostCode, CHARINDEX(' ', UF.PostCode)) = ANY(SELECT * FROM @PostCodes) AND UF.IsEuropean = 0))
  </code></pre>
  
  <p>Here <code>@PostCodes</code> is declared as a temporary table (like - <code>DECLARE @PostCodes TABLE</code>)</p>
  
  <ul>
  <li><code>UF.IsEuropean</code> column name and uf is the aliases name</li>
  <li><code>UF.PostCode</code> column name and uf is the aliases name</li>
  </ul>