I want to split a string in this format Quote:
\"date=10/10/2000|age=13^date=01/01/2001|age=12^date=02/02/2005|age=8\"
. Actually this stri
In general, I'd suggest to write a CLR function which split strings by regex or SQL table-valued function, but in you case you can try something simple like converting your string to xml and parsing it:
declare @str nvarchar(max) = 'date=10/10/2000|age=13^date=01/01/2001|age=12^date=02/02/2005|age=8'
declare @data xml
select @str = replace(@str, '=', '="')
select @str = replace(@str, '|', '" ')
select @str = replace(@str, '^', '"/>
'
select @data = cast(@str as xml)
select
t.c.value('@date', 'nvarchar(max)') as [date],
t.c.value('@age', 'nvarchar(max)') as [age]
from @data.nodes('row') as t(c)
sql fiddle demo