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.
References.
Discontinued Database Engine Functionality in SQL Server 2012.
|