This project is read-only.


fn_split (Transact_SQL)

See also: fn_split_xt


This table-valued UDF add the functionality of VB/C# SPLIT funtion/methods to TSQL and returns a table of values from a delimited string. 
 

Syntax

fn_split(@list, @delimiter)

 

Arguments

@list = NVARCHAR(MAX) , string containig the list of values to be split delimited by @delimiter parameter;

@delimiter = NCHAR(1), delimiter character used in the list for sepparating the values to split, usual chars are coma, semi-colon, pipe, etc.

 

Return type

Table with the following structure: id BIGINT IDENTITY(1,1), item_value NVARCHAR(MAX)

id = record number in the result table

item_value = individual value from the list split by the function

 

Remarks

none

 

Permissions

Public

 

Dependencies

none

 

Examples

SELECT * FROM [Lib].[tsql].[fn_split] ( 'Boston,New York,Chicago,Los Angeles,Sacramento,Buffalo,Orlando,Torornto,Montreal' , ',')

1 Boston
2 New York
3 Chicago
4 Los Angeles
5 Sacramento
6 Buffalo
7 Orlando
8 Torornto
9 Montreal

 

Other

none

 

Last edited Aug 16, 2012 at 1:36 PM by adudau, version 12

Comments

No comments yet.