请问这个怎么实现?不好弄啊。
有这样的数据 
    col 
 1,2,3 
 5,8,9 
 6,5,4   
 在sqlserver中怎么样把他转换成 
 Col1            col2            col3 
       1                  2                        3 
       5                  8                        9 
       6                  5                        4   
 有什么好办法没有?最好不要用游标,临时表。   我要写在一个函数中 
------解决方案--------------------select 
 Col1=left(col,charindex( ', ',col)-1), 
 Col2=substring(col,charindex( ', ',col)+1,charindex( ', ',col,charindex( ', ',col)+1)-charindex( ', ',col)-1), 
 Col3=reverse(left(reverse(col),charindex( ', ',reverse(col))-1)) 
 from 表
------解决方案--------------------create table #t 
  (col varchar(100)) 
 insert into #t 
 select  '1,2,3 ' union all 
 select  '5,8,9 ' union all 
 select  '6,5,4 '     
 select col1=substring(col,charindex( ', ',col+ ', ',1)-1,1), 
        col2=substring(col,charindex( ', ',col+ ', ',3)-1,1), 
        col3=substring(col,charindex( ', ',col+ ', ',5)-1,1)    
 from #t   
 col1 col2 col3  
 ---- ---- ----  
 1    2    3 
 5    8    9 
 6    5    4   
 (3 row(s) affected)
------解决方案--------------------如果这样,不要用SQL语句. 
 将数据导出到文本.然后再利用SQL的DTS导入,以逗号分隔就行了.