SQLServer表中字段按分隔符拆分為多行問題?
selectnum,id,substr(test1,0,instr(test1,',')-1)test1,substr(test2,0,instr(test2,',')-1)test2,substr(test3,0,instr(test3,',')-1)test3fromtable_name--前unionselectnum,id,substr(test1,instr(test1,',')+1)test1,substr(test2,instr(test2,',')+1)test2,substr(test3,instr(test3,',')+1)test3fromtable_name--后instr(test1,',')是計算逗號的位置。