[Company Logo Image] 

Home Up Contents Coffee Break Credits Glossary Links Search

The Compute Clause has been Discontinued



Analysis Services
CLR Integration
High Availability
Open Source
SQL Server 2008
SQL Server 2012
SQL Server 2014
SQL Server 2016
SQL Server 2017
SQL Server 2019

The Compute Clause has been Discontinued.

Applies to: Microsoft SQL Server 2012 , Microsoft SQL Server 2014 and later.

The COMPUTE clause is on the list of discontinued database engine functionalities starting SQL Server 2012 as you can read here.

I tested this trying to run the following SELECT statement against an AdventureWorks database attached to a SQL Server 2012 instance:

SELECT CustomerID, OrderDate, SubTotal, TotalDue
FROM Sales.SalesOrderHeader
WHERE SalesPersonID = 35
ORDER BY OrderDate
COMPUTE SUM(SubTotal), SUM(TotalDue);

When I tried to execute the SELECT statement I received the following syntax error:

Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'COMPUTE'.

The solution to this is using the ROLLUP clause instead.



Discontinued Database Engine Functionality in SQL Server 2012.



.Send mail to webmaster@sqlcoffee.com with questions or comments about this web site.