CREATE TABLE #t ( linkreturnid INT,id INT ) SELECT LinkReturnID,id INTO #t0 FROM CallCentre.cc.BackChangeApply WHILE EXISTS ( SELECT LinkReturnID,id FROM #t0 WHERE LinkReturnID LIKE '%,' ) BEGIN UPDATE #t0 SET LinkReturnID = RIGHT(LinkReturnID,LEN(LinkReturnID) - PATINDEX('%,%',LinkReturnID)) OUTPUT LEFT(deleted.LinkReturnID,PATINDEX('%,deleted.LinkReturnID) - 1),deleted.id INTO #t WHERE LinkReturnID LIKE '%,' END SELECT * FROM #t DROP TABLE #t,#t0 原文链接:https://www.f2er.com/javaschema/286698.html