SA0178 : LIKE operator is used without wildcards
The topic describes the SA0178 analysis rule.
LIKE operator is used without wildcards
This rule checks for LIKE operator usages without wildcard characters.
The use of LIKE without one or more wildcard characters in the pattern is probably a mistake.
The rule has a Batch scope and is applied only on the SQL script.
Parameter specifies whether to ignore LIKE predicate with pattern starting with "%" when it appears inside non-DML statements.
The rule does not need Analysis Context or SQL Connection.
Design Rules, New Rules
1SELECT LocationID 2FROM Locations 3WHERE Specialities LIKE 'A__les' 4 5SELECT LocationID 6FROM Locations 7WHERE Specialities LIKE 'App' 8 9SELECT LocationID 10FROM Locations 11WHERE Specialities LIKE 'A[^p]' 12 13SELECT LocationID 14FROM Locations 15WHERE Specialities LIKE 'Apples' /*IGNORE:SA0178*/ 16 17 18SELECT LocationID 19FROM Locations /*IGNORE:SA0178(STATEMENT)*/ 20WHERE Specialities LIKE 'pples' 21 22IF db_name() like '%za%' 23PRINT db_name()
|1||SA0178 : LIKE operator is used without wildcards.||7||29|
© Ubitsoft Ltd. All Rights Reserved.