declare @prodid intdeclare @Standard varchar(50)declare @S1 int declare @A varchar(20)declare prod cursor for select prodid,standard from produce where top_111=0open prod fetch next from prod into @prodid,@Standard while @@Fetch_Status=0begin set @S1=0 for i=0 to len(@stanard) if substring(@standard,i,1)<>'*' begin if (substring(@standard,i,1)>='0' and substring(@standard,i,1)<='9') or substring(@standard,i,1)='.' set @A=@A+substring(@standard,i,1) end else begin set @S1=@S1+1 if @s1=1 update produce set top_111=@A where prodid=@prodid set @A='' end next if @s1=0 update produce set top_111=@A where prodid=@prodid if @s1>0 and substring(@standard,1,1)<>'m' update produce set tak_111=@A where prodid=@prodid fetch next from prod into @prodid,@Standardendclose proddeallocate prod