日期:2014-05-18 浏览次数:20611 次
Declare @CurrentID int, @JobCode char(10),@Date char(10),@Time char(4) BEGIN TRY SET @CurrentID = 1; Select @JobCode = JobCode,@Date = [Date],@Time = [Time] from Atd_DataReceive where DataReceiveId = @CurrentID; WHILE (@@ROWCOUNT >= 1) BEGIN UPDATE Atd_DayResult SET Time1 = @Time WHERE JobCode = @JobCode AND AtdDate = @Date SET @CurrentID = @CurrentID + 1; SELECT @JobCode = JobCode,@Date = [Date],@Time = [Time] from Atd_DataReceive WHERE DataReceiveId = @CurrentID; END COMMIT TRANSACTION END TRY
update a SET Time1=b.[Time] from Atd_DayResult a,Atd_DataReceive b where a.JobCode =b.JobCode and a.[Date]=b.[Date]