title: Ambiguous column name error in SQL Server 2012
body: <p>Please see the following query. </p>
  
  <pre><code>select UserStatus,UserStatus from ((Select 'Active' as UserStatus) 
   union (Select 'Inactive' as UserStatus))a order by UserStatus  
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Msg 209, Level 16, State 1, Line 3
  Ambiguous column name 'UserStatus'
  </code></pre>
  
  <p>Solution:</p>
  
  <pre><code>ALTER DATABASE VCarePortal
  SET COMPATIBILITY_LEVEL = 100
  
  90 = SQL Server 2005`enter code here`
  100 = SQL Server 2008 and SQL Server 2008 R2
  110 = SQL Server 2012.
  </code></pre>
  
  <p>I tried about compatibility level mode. but still i'm getting ambiguous error.</p>