我只會寫一個 funcation,並使用 cross apply call the funcation. 此 query 好象 很利害, 不需要 function. http://mangalpardeshi.blogspot.com/2009/03/how-to-split-comma-d Create Sample Data : -- Create Table for Sample Data CREATE TABLE Test ( ID INT, AllNames VARCHAR(100) ) GO -- Load Sample Data INSERT INTO test SELECT 1, 'A,B,C' UNION ALL SELECT 2, 'A,B' UNION ALL SELECT 3, 'X,Y,Z' GO -- Verify the Sample Data SELECT Id, AllNames FROM Test And here is the query for How to split a comma delimited string : ;WITH Cte AS ( SELECT id, CAST('' + REPLACE( Allnames, ',' , '') + '' AS XML) AS Names FROM Test ) SELECT ID, Split.a.value('.', 'VARCHAR(100)') AS Names FROM Cte CROSS APPLY Names.nodes('/M') Split(a)