DECLARE cursor_name CURSOR FOR --定义游标 SELECT REPLACE(JSURL,'&FP=1&FP=1','&FP=1'),JSImgID FROM [srv_lnk_wps].wps_jt_2017.dbo.T_JSURL0331 WHERE JSImgID IS NOT NULL AND JSURL IS NOT NULL GROUP BY JSImgID,JSURL OPEN cursor_name --打开游标 declare @JSURL NVARCHAR(100), @JSImgID int the FETCH the NEXT the FROM cursor_name the INTO @JSURL , @JSImgID - fetch the next line of cursor data the WHILE @@ FETCH_STATUS = 0 the BEGIN the UPDATE [ srv_lnk_wps ] .wps_jt_2017.dbo.T_IMAGEURL0331 the SET F_ADDR_Url = @JSURL the WHERE ID = @JSImgID the FETCH the NEXT the FROM cursor_name the INTO @JSURL , @JSImgID the END the CLOSE cursor_name - close a cursor the DEALLOCATE cursor_name -Cursor release