Create FUNCTION [dbo].[SplitStr](  
	@delimited NVARCHAR(MAX),  
	@delimiter NVARCHAR(100)  
) RETURNS @table TABLE ([value] NVARCHAR(MAX))  
AS  
BEGIN  
	DECLARE @xml XML  
	SET @xml = N'<t>' + REPLACE(@delimited,@delimiter,'</t><t>') + '</t>'  
	INSERT INTO @table([value])  
		SELECT r.value('.','Nvarchar(MAX)') as item  
			FROM @xml.nodes('/t') as records(r)  
		RETURN  
END  
