The best splitter for T-SQL is right here
along with several tests. It will outperform any splitter using while loops or xml.
With it, you can replace your function to this. Note that it has a limit to 4000 unicode chars (8000 for non-unicode) to avoid the use of large data types and improve performance.
-- Split and concatenate back to string
CREATE FUNCTION [dbo].[Split_and_concatenate]
SELECT STUFF( (SELECT '; ' + CASE Item WHEN '1' THEN '11'
WHEN '2' THEN '22'
ELSE '33' END
FROM dbo.[DelimitedSplitN4K](@str, @delimiter)
FOR XML PATH('')),1,2, '')
Luis C.General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?How to post data/code on a forum to get the best help: Option 1 / Option 2