This UDF will take a delimited string and split it into a table. It has an identity field that is provided solely for uniqueness on the rows, but that can be removed to improve the speed, and optimize it. Sample call :
dbo.fnSplit(, )
@Data - the string to split apart
@Delimiter - the seperator string, if DEFAULT or NULL is sent in, a comma will be used.
Updated 12-07-02
Now allows for multi character delimters.
EX :
SELECT * from dbo.fnSplit('test1<|>test2', '<|>')
OR
SELECT * from dbo.fnSplit('test1##DELIM##test2', '##DELIM##')
Or whatever other delimeter your heart desires.
Updated : 12-10-02
Fixed a bug if a 10 char delimiter was sent in it would not properly parse the string.