任务-1:请帮我查询或存储过程以分割逗号值。
任务-2:使用ROW1数据可以做什么最好?
Column-A Column-B
Vildagliptin,Exenatide,5075,,4085,
Canakinumab,3743,
Canagliflozin,3742,
Canakinumab,3743,
答案 0 :(得分:0)
尝试这样,(不使用功能)
SELECT [Column-A],
LTRIM(RTRIM(m.n.value('.[1]','varchar(8000)'))) AS [Column-B]
FROM
(
SELECT [Column-A],CAST('<XMLRoot><RowData>' + REPLACE([Column-B],',','</RowData><RowData>') + '</RowData></XMLRoot>' AS XML) AS x
FROM <YourTable>
)t
CROSS APPLY x.nodes('/XMLRoot/RowData')m(n)