fn_seek_val (Transact_SQL)


 

This scalar UDF returns the index of a given element item from a comma delimited list of values.


Syntax

fn_seek_val(@list,@item_value)



Arguments

@list = NVARCHAR(MAX) , string containing the list of values comma sepparated;

@item_value = NVARCHAR(4000), value to find



Return type
BIGINT =  [Index+1] where item is found. 0 if element not found


Remarks

Return value is 0 if element not found. 



Permissions
-
Public
-
Dependencies

[Lib].[tsql].fn_split(@list, @delimiter)



Examples

SELECT [Lib].[tsql].fn_seek_val( ' 1,2,2,2,3,4,5', '2' )

Result
2



Other

none

Last edited Oct 22, 2012 at 5:59 AM by paragag, version 4

Comments

No comments yet.