SA0199 : Usage of deprecated COMPUTE clause encountered
The topic describes the SA0199 analysis rule.
Usage of deprecated COMPUTE clause encountered
The rule checks and reports usages of the deprecated COMPUTE clause.
The COMPUTE and COMPUTE BY clauses are deprecated and are not supported in SQL Server 2012 and later.
Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. Use ROLLUP instead.
The result set of a ROLLUP operation has functionality similar to that returned by a COMPUTE BY. However, ROLLUP has the some advantages:
– ROLLUP returns a single result set while COMPUTE BY returns multiple result sets that increase the complexity of application code.
– ROLLUP can be used in a server cursor while COMPUTE BY cannot.
– The query optimizer can sometimes generate more efficient execution plans for ROLLUP than it can for COMPUTE BY.
The rule has a Batch scope and is applied only on the SQL script.
Rule has no parameters.
The rule does not need Analysis Context or SQL Connection.
Design Rules, Deprecated Features, Bugs
There is no additional info for this rule.
1SELECT Country, State, City, Population 2FROM Country C 3ORDER BY Name, State, City 4COMPUTE SUM(Population) BY Country, State 5 6SELECT Country, State, City, SUM (Population) AS Population 7FROM Country C 8GROUP BY Country, State, City 9WITH ROLLUP
|1||SA0199 : Usage of deprecated COMPUTE clause encountered.||4||0|