BigDaddyCardona BigDaddyCardona - 4 months ago 31x
SQL Question

SQL 2008 VS 2012 Error: Incorrect syntax near the keyword 'COMPUTE'

My friend sent me the commands that he wrote in server 2008 and they worked with no problems, mine however from a copy and past did not work with 2012. Is there any reason why? Here is the code:

Use Kudler_Database
SELECT AccountNumber, [Description], ShortDescription,Balance
FROM Chart_of_Accounts
ORDER BY left (AccountNumber, 2)
COMPUTE SUM(Balance) BY left (AccountNumber, 2)

Here is the error :

Msg 156, Level 15, State 1, Line 6 Incorrect syntax near the keyword


COMPUTE is no longer available in SQL server 2012, thats why you are getting that error. See this page:

It said that:

This topic describes the Database Engine features that are no longer available in SQL Server 2012:

*Transact-SQL syntax | COMPUTE / COMPUTE BY *