問題:
給定一個包含逗號分隔列的表值,目標是將每個值轉換為單獨的值rows.
查詢:
SELECT A.[id], Split.a.value('.', 'VARCHAR(100)') AS processedrows FROM (SELECT [id], CAST ('<M>' + REPLACE([string], ',', '</M><M>') + '</M>' AS XML) AS String FROM Sample) AS A CROSS APPLY String.nodes ('/M') AS Split(a);
解釋:
參考:
以上是如何從 SQL 中以逗號分隔的列值中提取行?的詳細內容。更多資訊請關注PHP中文網其他相關文章!