Home

Lines should not be too long

Rule description

  • Lines should not be too long

 

Non-compliant Code Example

SELECT ProductID, ProductName, ProductCategory, Price, InStockQuantity, AVG(OrderQty) AS AverageQuantity, SUM(LineTotal) AS Total --Non compliant code (Line length is more then default defined limit 100)
FROM Sales.SalesOrderDetail
GROUP BY ProductID
HAVING SUM(LineTotal) > 3000.00
AND AVG(OrderQty) < 3;

Compliant Code Example

SELECT ProductID, ProductName, --Compliant code (Line length is less then default defined limit 100)
 ProductCategory,
 Price,
 InStockQuantity,
 AVG(OrderQty) AS AverageQuantity,
 SUM(LineTotal) AS Total
FROM Sales.SalesOrderDetail
GROUP BY ProductID
HAVING SUM(LineTotal) > 3000.00
AND AVG(OrderQty) < 3;
Visual Expert 2020
 VETSQLRULE76