title: Entity Framework 4.0: Entity SQL CAST Operation Not Working
body: <p>I'm trying to make a query where I cast a text column, which contains an integer as text, to an Int32. Here's the query:</p>
  
  <pre><code>SELECT VALUE t FROM MyEntities AS t WHERE CAST(t.TextColumn AS Edm.Int32) &gt; 5
  </code></pre>
  
  <p>However, I get an System.Data.EntitySqlException with the following message:</p>
  
  <blockquote>
    <p>Type 'Edm.Int32' could not be found. Make sure that the required schemas are loaded and that the namespaces are imported correctly. Near type name, line 1, column 75.</p>
  </blockquote>
  
  <p>According to <a href="http://msdn.microsoft.com/en-us/library/bb399172.aspx" rel="nofollow">MSDN</a>, Edm.Int32 should be a valid type.</p>
  
  <p>Does anyone know what's wrong?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>After some trial and error, I found that the following works:</p>
  
  <pre><code>SELECT VALUE t FROM MyEntities AS t WHERE CAST(t.TextColumn AS System.Int32) &gt; 5
  </code></pre>
  
  <p>Are the examples in MSDN wrong? I feel like I'm missing something here...</p>