title: Compare two nvarchar columns with Unicode text in SQL server 2012
body: <p>In MS SQL Server 2012 I want to compare two columns with data type nvarchar which contain Unicode text.</p>
  
  <p>Following query returns nothing even thought the values are different.</p>
  
  <pre><code>DECLARE @TABLE TABLE(
      A nvarchar(100),
      B nvarchar(100)
  );
  
  INSERT INTO @TABLE VALUES (N'A²', N'A2')
  
  SELECT *
  FROM @TABLE 
  WHERE A &lt;&gt; B;
  </code></pre>
  
  <p>I tried with binary collation and it works:</p>
  
  <pre><code>DECLARE @TABLE TABLE(
      A nvarchar(100),
      B nvarchar(100)
  );
  
  INSERT INTO @TABLE VALUES (N'A²', N'A2');
  
  SELECT *
  FROM @TABLE 
  WHERE A COLLATE Latin1_General_BIN = B COLLATE Latin1_General_BIN;
  </code></pre>
  
  <p>Is there any other option or can this only be done with collation?</p>