SqlServer复杂存储过程
SqlServer复杂存储过程
CREATE PROCEDURE FETCH_GOOUT_INFO AS BEGIN WITH l as(SELECT A.ZJHM, O.KSQR, O.JSRQ, o.PK_ID FROM t_go_out o, T_CORRECT_ARCHIVE a WHERE o.A_PK = a.PK_ID AND a.DR = 0 AND O.DR = 0) UPDATE t SET t.startqjrq = l.KSQR, t.endqjrq = l.JSRQ, t.gooutPk = l.PK_ID FROM T_TICKET_INFO t, l WHERE t.sfzh = l.zjhm AND substring(t.fcsj,1,10) between l.KSQR and l.JSRQ AND t.startqjrq is null END
不积跬步无以至千里,不积小流无以成江海