Sql Server游标典型例子
BEGIN SET NOCOUNT ON; DECLARE @materialid VARCHAR(50) DECLARE P_C CURSOR LOCAL FAST_FORWARD FOR SELECT materialid FROM **** WHERE ebommainid=@id; OPEN P_C FETCH NEXT FROM P_C INTO @materialid WHILE @@FETCH_STATUS = 0 BEGIN --业务逻辑 FETCH NEXT FROM P_C INTO @materialid END CLOSE P_C DEALLOCATE P_C