SA0165 : TOP (100) PERCENT found |
The topic describes the SA0165 analysis rule.
TOP (100) PERCENT found
This rule checks for the phrase “TOP (100) PERCENT”.
This phrase has no bearing unless the percentage is less than 100.
This phrase is commonly generated by creating a view in the SQL Server View Designer.
Remove the TOP (100) PERCENT clause form the query.
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, Code Smells
There is no additional info for this rule.
SQL
1SELECT TOP 99 PERCENT 2 LastName, FirstName, JobTitle, Department 3FROM HumanResources.vEmployeeDepartment 4ORDER BY LastName ASC 5 6SELECT TOP 100 PERCENT 7 LastName, FirstName, JobTitle, Department 8FROM HumanResources.vEmployeeDepartment 9ORDER BY LastName ASC 10 11SELECT TOP 100 PERCENT 12 LastName, FirstName, JobTitle, Department 13FROM HumanResources.vEmployeeDepartment 14 15SELECT TOP (100) PERCENT /*IGNORE:SA0165(LINE)*/ 16 LastName, FirstName, JobTitle, Department 17FROM HumanResources.vEmployeeDepartment 18 19SELECT 20 F.Code, 21 F.CustNum, 22 SupplierCode = ((SELECT TOP 100 PERCENT S.SupplierCode FROM Supplier S WHERE S.FacilityCode = F.FacilityCode)) 23FROM Facility F; |
Message | Line | Column | |
---|---|---|---|
1 | SA0165 : TOP (100) PERCENT found. | 6 | 7 |
2 | SA0165 : TOP (100) PERCENT found. | 11 | 7 |
3 | SA0165 : TOP (100) PERCENT found. | 22 | 25 |