shahromi
29th September 2014, 05:21
Hi everyone,
How to include like in SQl Query
Instead of From & To, the user needs to search item description
How to replace like for this From & To
tdpur201.nids >= tdpur201.nids.f and
tdpur201.nids <= tdpur201.nids.t
Thank You.
bdittmar
29th September 2014, 09:29
Hello,
LIKE predicate
The LIKE predicate matches a value with a pattern.
Infor ERP LN SQL has two like keywords: LIKE and ALIKE.
The handling of the LIKE keywords depends on the optional mode argument of the sql.parse() function. With the PARSE.ANSI flag set, the LIKE keyword is a synonym of the ALIKE keyword.
If this flag is not set, the LIKE predicate evaluates to True if the value expression matches the string pattern. The matching is based on Regular Expressions.
Syntax
<like predicate>
::= <ansi-like predicate> | <regexp-like predicate>
<ansi-like predicate>
::= Value expression [NOT] ALIKE String constant
[ESCAPE String constant]
<regexp-like predicate>
::= Value expression [NOT] LIKE String constantSyntactical restrictions
The ALIKE keyword generates a 42I82 - Syntax conflicts with Parse mode when the PARSE.ANSI flag is set in the optional mode argument of the sql.parse() function.
The type of the <value expression> shall be string.
Semantics
If the value of the <value expression> is NULL, then the result of the LIKE predicate is Unknown.
The result of the LIKE predicate (non ansi mode) is equivalent with the following expression using expr.compile() and using the value of the value expression for the optional argument to l.expr().
$$ IN "<string constant>"
The ALIKE predicate evaluates to True if the <value expression> matches the <string contant> pattern. Within this <string contant>, the character % matches any string of zero or more characters. The character _ matches any single character. A wildcard character will be treated as literal if preceded by the escape character as defined by the optional ESCAPE keyword.
Examples
The following predicate evaluates to True if firstnme is 'CHRISTINE'. Note: no blank padding is applied! So, if firstnme is 'CHRISTINE ' it evaluates to False.
firstnme LIKE 'CHRISTINE'
The following predicate evaluates to True if firstnme starts with an 'A'.
firstnme LIKE 'A.*' AND firstnme ALIKE 'A%'
The following predicate evaluates to True if firstnme start with a 'C' or an 'H'.
firstnme LIKE '[CH].*'
The following predicate evaluates to True if firstnme does not start with an 'I'.
firstnme LIKE '[^I].*'
Regards