Home

Columns to be read with a SELECT statement should be clearly defined

Rule description

  • Columns to be read with a SELECT statement should be clearly defined

 

Non-compliant Code Example

SELECT *  --Non compliant code (Selecting all the column irrespective it is required or not)
FROM Production.Product  
ORDER BY ListPrice;

Compliant Code Example

SELECT Product.ProductID,  --Compliant code 
Product.Name,
Color  
FROM Production.Product  
ORDER BY ListPrice;
Visual Expert 2020
 VETSQLRULE36