清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
DECLARE @EvId INT,@PiD INT; DECLARE Evaluate CURSOR FOR SELECT EvaluateId,ProductId FROM dbo.ProductEvaluate WHERE CreateTime > '2014-10-20 00:00:01'; OPEN Evaluate; FETCH NEXT FROM Evaluate INTO @EvId,@PiD; WHILE @@FETCH_STATUS = 0 BEGIN DECLARE @BDate datetime, @EDate DATETIME,@PDate DATETIME; SET @BDate = '20140101' --下限 SELECT @BDate = CONVERT(varchar(100), CreateTime, 112) FROM dbo.Products WHERE ProductId = @PiD; SET @EDate = '20141020 23:59:59' --上限 UPDATE dbo.ProductEvaluate SET CreateTime =DATEADD(second,ABS(CHECKSUM(NEWID()))%DATEDIFF(second,@BDate,@Edate),@BDate) WHERE EvaluateId = @EvId ; FETCH NEXT FROM Evaluate INTO @EvId,@PiD; END CLOSE Evaluate; DEALLOCATE Evaluate;