title: Convert query PIVOT from Oracle to SQL Server error
body: <p>Currently I am converting the an Oracle trigger to SQL Server, but I run into a problem.</p>
  
  <p>My query in Oracle is like this</p>
  
  <pre><code>SELECT 
      CUSTOMER_ID, NVL(MATRIX1,0) MATRIX1, NVL(MATRIX2,0) MATRIX2
  FROM 
      (SELECT DISTINCT 
           CUSTOMER_ID, SCORE 
       FROM STABLE) A
  PIVOT (SUM(1) AS SCORE_MATRIX FOR (SCORE) IN (
                                                1 AS IND_1, 2 AS IND_2));
  </code></pre>
  
  <p>My T-SQL query in SQL Server looks like this </p>
  
  <pre><code>SELECT 
      CUSTOMER_ID, ISNULL(MATRIX1,0) AS MATRIX1, ISNULL(MATRIX2,0) AS MATRIX2
  FROM 
      (SELECT DISTINCT 
           CUSTOMER_ID, SCORE 
       FROM STABLE) A
  PIVOT (SUM(1) AS SCORE_MATRIX FOR (SCORE) IN (
                                                1 AS IND_1, 2 AS IND_2)) PVT;
  </code></pre>
  
  <p>However I get an error:</p>
  
  <blockquote>
    <p>Msg 102, Level 15, State 1, Line 18<br>
    Incorrect syntax near '1'.</p>
  </blockquote>
  
  <p>I could not figure out why for this error, so could anyone help identify? Thank you very much!</p>