问问题
262 次
1 回答
1
单程
DECLARE @S VARCHAR(MAX) = '1,100,12345|2,345,433|3,23423,123|4,33,55'
DECLARE @x xml = '<r><c>' +
REPLACE(REPLACE(@S, ',','</c><c>'),'|','</c></r><r><c>') +
'</c></r>'
SELECT x.value('c[1]','int') AS seq,
x.value('c[2]','int') AS invoice,
x.value('c[3]','int') AS amount
FROM @x.nodes('/r') x(x)
于 2013-09-18T11:32:00.043 回答