--请在分店和配送中心选择对应的数据库,然后执行语句
declare @dt_max datetime, @dt_tmp datetime, @flowid_begin int, @flowid_end int, @flowid_tmp int
select @dt_max = max(dt_oper_date) from cybr_st_material_io_flow where convert(char(10), dt_oper_date, 121) = '2014-01-31'
select @flowid_begin = min(int_flowid), @flowid_end = max(int_flowid) from cybr_st_material_io_flow
where dt_oper_date between '2014-02-01 00:00:00' and '2014-02-02 20:00:00'
set @dt_tmp = @dt_max
declare c_cp cursor for select int_flowid from cybr_st_material_io_flow where int_flowid between @flowid_begin and @flowid_end order by int_flowid asc
open c_cp
fetch c_cp into @flowid_tmp
while(@@fetch_status = 0)
begin
set @dt_tmp = dateadd(ss, 1, @dt_tmp)
update cybr_st_material_io_flow set dt_oper_date = @dt_tmp where int_flowid = @flowid_tmp
fetch c_cp into @flowid_tmp
end
close c_cp
deallocate c_cp
go
网址:http://www.yonje.net
地址:大同市魏都大道南环路口富临宝城B座809