Hi,
i want to know if i give some value like this:
select * from split('11,12|13,15|16,18')
i should get the output as
Id Value1 Value2
1 11 12
2 13 15
3 16 18
please help me ,how to do this in sql server 2005
Thanks in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
priya priyaPosted Aug 25, 2009, 1:19 AM
'11,12|13,14|15,16'
I want to write a function in sql to remove that ',' and '|' and i need my output as follows:
id value1 value2
1 11 12
2 13 14
3 15 16
thanks in advance
Roei BarPosted Aug 24, 2009, 4:11 PM
like this
TableName t
CROSS APPLY dbo.udf_PivotParameters(t.fieldnamewithcommas, ',')
just insert the values to a temptable the pivot it with the code attached above
remember to mark this as "Accepted Answer"