Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Entity SQL includes string canonical functions.
Remarks
The following table shows the string Entity SQL canonical functions.
Function | Description |
---|---|
Concat (string1, string2) |
Returns a string that contains string2 appended to string1. Arguments string1: The string to which string2 is appended. string2: The string that is appended to string1. Return Value A String. An error will occur if the length of the return value string is greater than the maximum length allowed. Example
|
Contains (string, target) |
Returns true if target is contained in string. Arguments string: The string that is searched. target: The target string that is searched for. Return Value true if target is contained in string; otherwise false. Example
|
EndsWith (string, target) |
Returns true if target ends with string. Arguments string: The string that is searched. target: The target string searched for at the end of string. Return Value True if string ends with target; otherwise false. Example
![]()
If you are using the SQL Server data provider, this function returns false if the string is stored in a fixed length string column and target is a constant. In this case, the entire string is searched, including any padding trailing spaces. A possible workaround is to trim the data in the fixed length string, as in the following example:
EndsWith(TRIM(string), target)
|
IndexOf(target, string) |
Returns the position of target inside string, or 0 if not found. Returns 1 to indicate the beginning of string. Index numbering starts from 1. Arguments target: The string that is searched for. string: The string that is searched. Return Value An Int32. Example
|
Left (string, length) |
Returns the first length characters from the left side of string. If the length of string is less than length, the entire string is returned. Arguments string: A String. length: An Int16, Int32, Int64, or Byte. length cannot be less than zero. Return Value A String. Example
|
Length (string) |
Returns the (Int32) length, in characters, of the string. Arguments string: A String. Return Value An Int32. Example
|
LTrim(string) |
Returns string without leading whitespace. Arguments A String. Return Value A String. Example
|
Replace (string1, string2, string3) |
Returns string1, with all occurrences of string2 replaced by string3. Arguments A String. Return Value A String. Example
|
Reverse (string) |
Returns string with the order of the characters reversed. Arguments A String. Return Value A String. Example
|
Right (string, length) |
Returns the last length characters from the string. If the length of string is less than length, the entire string is returned. Arguments string: A String. length: An Int16, Int32, Int64, or Byte. length cannot be less than zero. Return Value A String. Example
|
RTrim(string) |
Returns string without trailing whitespace. Arguments A String. Return Value A String. |
Substring (string, start, length) |
Returns the substring of the string starting at position start, with a length of length characters. A start of 1 indicates the first character of the string. Index numbering starts from 1. Arguments string: A String. start: An Int16, Int32, Int64 and Byte. start cannot be less than one. length: An Int16, Int32, Int64 and Byte. length cannot be less than zero. Return Value A String. Example
|
StartsWith (string, target) |
Returns true if string starts with target. Arguments string: The string that is searched. target: The target string searched for at the start of string. Return Value True if string starts with target; otherwise false. Example
|
ToLower(string) |
Returns string with uppercase characters converted to lowercase. Arguments A String. Return Value A String. Example
|
ToUpper(string) |
Returns string with lowercase characters converted to uppercase. Arguments A String. Return Value A String. Example
|
Trim(string) |
Returns string without leading and trailing whitespace. Arguments A String. Return Value A String. Example
|
These functions will return null if given null input.
Equivalent functionality is available in the Microsoft SQL Client Managed Provider. For more information, see SqlClient for Entity Framework Functions.