A paging problem, DTCms3.0, paging is based on the time page, if the Add Time (add_time) is the same value, regardless of the number of pages clicked, the data displayed is the same content, so there is a need to change the same time to specify a random date function.
The SQL script is as follows:
DECLARE @BDate datetime,@EDate datetimeSET @BDate = '20150701' --Lower LimitSET @EDate = '20150714 23:59:59' --Upper LimitSELECTID, Random_datetime= DATEADD(Second,ABS(CHECKSUM (NEWID()))%DATEDIFF(Second,@BDate,@Edate),@BDate) fromdbo.dt_articleWHEREIdbetween 1 and -
The resulting content is:
IdRandom_datetime3 2015-07-05 07:55:10.0004 2015-07-08 06:15:06.0009 2015-07-12 19:14:24.00010 2015-07-11 20:13:05.00012 2015-07-06 19:09 : 12.00013 2015-07-09 10:28:59.00014 2015-07-03 07:18:42.00015 2015-07-06 09:46:29.000
The ID at this time is the ID in the corresponding dt_article table.
Then we can write the generated data to the temporary table, then associate the update!
We modify the script as follows:
SELECTID, Random_datetime= DATEADD(Second,ABS(CHECKSUM (NEWID()))%DATEDIFF(Second,@BDate,@Edate),@BDate) into#Temp fromdbo.dt_article--Update DateUPDATEDbo.dt_articleSETAdd_time=B.random_datetime fromDbo.dt_article A, #TempbWHEREa.ID=b.ID
SQL Server randomly generates a specified range of dates