T-SQL: UDF SplitString() – Split String into an Array (Table) with Multi-Character Delimiter

An user-defined function to convert comma separated values (CSV) to an Array (table) is always needed.
I wrote one that uses a multi-character delimiter and returns not/trimmed values. The string searches for the delimiter, inserts the left slice into the resulting table and cuts the left slice from the string. The ID column is used to pick the second, third etc. value from the string or to order the array.

Create database

Create udf_SplitString()

Test udf_SplitString()


Delete database

Keep it simple :-)