Saturday, July 4, 2009

Error While Executing PIVOT Operator.

Is sql when we Use Pivot Operation Some times It Fires Incorrect syntax near '('.
This Exception Is Due to law Compatibility level. to resolve this error Just set compatibility level to higher than current level.

we can get status of compatibility level using stored procedure sp_dbcmptlevel.
to get current level : sp_dbcmptlevel @dbname ='DatabaseName'
to set new level: sp_dbcmptlevel @dbname ='DatabaseName', @new_cmptlevel = 80