SQLStrLike - DataDictionary
Helper function that will create an SQL LIKE string for a table column and a target value to be used in the WHERE clause of SQL statements
Type: Function
Return Data Type: String
Parameters
| Parameter | Type | Description |
|---|---|---|
| iField | Integer | Table column to create statement for |
| sSearch | String | Search string |
Syntax
Function SQLStrLike Integer iField String sSearch Returns String
Call Example
Get SQLStrLike iField sSearch to StringVariable
Description
This is a helper function that will create an SQL LIKE string for a table column and a target value to be used in the WHERE clause of SQL statements.
SQLStrLike will always add the N prefix to the result string, making this function work when used against any backend and Unicode data.
Sample
For example, this sample would return the value "Customer.Name LIKE N'%ab%'" in sFilter.
Get SQLStrLike field Customer.Name "ab" to sFilter
You should not call SQLEscapedStr when setting SQLStrLike because SQLStrLike already calls that function.
Besides calling SQLEscapeString and placing SQL LIKE characters around the search keyword, this function also escapes `%' and "_" in the search string with prepending the character with a backslash when the search string does not contain a backslash. Lastly, ESCAPE '\' is added to the SQL filter to tell the engine the backslash is the escape character.
See Also
Return Value
A LIKE string to be used in the WHERE clause of an SQL statement.