Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Wiki Markup
Returns the position of the specified character or sequence. Zero (0) is returned if the string given as search parameter does not exist. The optional _start_position_ parameter specifies the position in the string to start searching.
Syntax:
CHARINDEX (string_to_search, search_for \[,start_position\])
Example:
/* returns 3 as it is the first occurrence of the character 'c' in the string */SELECT CHARINDEX ('abcda1234', 'c')
/* returns 5 as the first occurrence of 'a' on or after position 2 is on position 5 in the string */SELECT CHARINDEX ('abcda1234','a',2)
/* returns 0 as the character does exist in the string */SELECT CHARINDEX ('abcda1234','x')
\\
 \\