fn_occurs (Transact_SQL)

See also: fn_word_count

 


This scalar UDF counts the occurences of a substring within a string.
 

Syntax

 fn_occurs(@string,@search_for) 

 

Arguments

@string = NVARCHAR(MAX) , string containing the occurences;

@search_for = NVARCHAR(MAX), substring to search for occurences within @string.

 

 

Return type

BIGINT

Remarks

none

 

Permissions

Public 

Dependencies

none

 

Examples

SELECT

[Lib].[tsql].[fn_occurs] ('THIS IS A STRING TO SEARCH FOR OCCURENCES','C' )

 Result

 

4

Other

none

 

Last edited Aug 28, 2012 at 5:09 PM by adudau, version 3

Comments

No comments yet.