Incorrect Syntax Near 'PIVOT' ???

Posted by Peermohamedmydeen under Sql Server on 8/31/2010 | Points: 10 | Views : 8311 | Status : [Member] | Replies : 1
Hello All,

I don't have much knowledge in PIVOT in SQL Server.

I tried the cross tab query using PIVOT.

The below error raised, What I have to do for this?

Msg 325, level 15, State 1, Line 2
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 stored procedure sp_dbcmptlevel.

In sp_dbcmptlevel, They specified some compatibility levels 60,65,70,80 or 90.

Where I can find Compatibility levels in DataBase?

Thanks and Regards
PMM :)


Posted by: Vuyiswamb on: 8/31/2010 [Member] [MVP] [Administrator] NotApplicable | Points: 25

This Error means that your Database is still using the Old SQL 2000 Compatibility, So what you need to do is

1)Right Click on your Database and go to Properties

2) Select Options

2)In the Compatibility Level change it "SQL 2005 (90)"

and it will work.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response