Login     Register

        Contact Us     Search

XLeratorDB/strings Online Documentation

SQL Server FIND function


FIND

Updated: 30 April 2009

Use FIND to locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.
Syntax
SELECT [wctString].[wct].[FIND] (
   <@Find_text, nvarchar(max),>
 ,<@Within_text, nvarchar(max),>
 ,<@Start, int,>)
Arguments
@Find_text
is the text to you want to find. The @Find_text argument can be of data types that are implicitly convertible to nvarchar or ntext.
 
@Within_text
is the text containing the text you want to find . The @Within_text argument can be of data types that are implicitly convertible to nvarchar or ntext.
 
@Start
specifies the position at which to start searching @Within_text. The first position in @Within_text is 1. The @Start argument must be of data types that are implicitly convertible to int.
 
Return Types
int
Remarks
·         FIND does not support the use of wildcards.
·         FIND is case sensitive.
·         If @Start is NULL, FIND starts searching @Within_text at position 1.
·         IF @Find_text does not appear in @Within_text, FIND returns zero.
·         0 < @Start_num < LEN(@Within_text)
Examples
 
select wct.FIND('fathers'
,'Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.'
,NULL
)
This produces the following result
-----
36
 

(1 row(s) affected)



Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service