title: Is PIVOT supported with compatibility_level 80?
body: <p>I have written a query using PIVOT function.The db is on client side. When i am running the query it throws an error,</p>
  
  <pre><code>Incorrect syntax near 'PIVOT'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the SET COMPATIBILITY_LEVEL option of ALTER DATABASE.
  </code></pre>
  
  <p>After this I ran these two queries,</p>
  
  <pre><code>SELECT @@version;
  SELECT compatibility_level FROM sys.databases WHERE name = 'db_name';
  </code></pre>
  
  <p>The output is </p>
  
  <pre><code>Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) 
  Jun 17 2011 00:54:03 
  Copyright (c) Microsoft Corporation
  Standard Edition (64-bit) on Windows NT 6.1 &lt;X64&gt; (Build 7601: Service Pack 1)
  </code></pre>
  
  <p>and </p>
  
  <pre><code>80
  </code></pre>
  
  <p>I am not a db expert, But what I guess is they are using SQL server 2008 with compatibility mode of SQL server 2000 i.e 80 .Let me know if I am wrong. I do not think the Client will agree to change the compatibility level. So Is there any way to run a PIVOT query?</p>