Difference between revisions of "CHARINDEX()"

From Lianjapedia
Jump to: navigation, search
(Created page with "==Purpose== Function to return the starting position of one character expression in another character expression if found ==Syntax== CHARINDEX(<expC1>,<expC2>[, <expN>]) ==S...")
 
(Example)
 
Line 14: Line 14:
 
<code lang="recital">
 
<code lang="recital">
 
? charindex("is","This is a test")
 
? charindex("is","This is a test")
        3
+
          3
  
 
open database southwind
 
open database southwind

Latest revision as of 10:30, 27 March 2018

Purpose

Function to return the starting position of one character expression in another character expression if found

Syntax

CHARINDEX(<expC1>,<expC2>[, <expN>])

See Also

AGGREGATES, AT(), ATNEXT(), CHOOSE(), CLEAR SMARTQUERY, CREATE CURSOR, CREATE TABLE, EXPLAIN, FETCH, INLIST(), INSERT, LEFT(), LIKE(), LOOKUP(), OCCURS(), OPERATORS, PREDICATES, PSEUDO COLUMNS, RAT(), RIGHT(), RLOOKUP(), SET SMARTQUERY, SET SQLROWID, SET XMLFORMAT, STR(), STREXTRACT(), STRTRAN(), STUFF(), SUBSTR(), SYSTEM TABLES, UPDATE

Description

The CHARINDEX() function returns the starting position of the character expression <expC1> in the character expression <expC2>. If <expC1> is not found in <expC2>, CHARINDEX() returns 0. The numeric expression <expN> is the optional starting position for the search.

Example

? charindex("is","This is a test")
          3
 
open database southwind
select charindex(",",notes) from employees
          1
        231
          1
          1
        248
         73
        240
          1
        109