数据库
首页 > 数据库> > MSSQL随机修改时间

MSSQL随机修改时间

作者:互联网

GO

DECLARE @BDate datetime, @EDate datetime
SET @BDate = '20190801'          --上限
SET @EDate = '20190819 23:59:59' --下限

UPDATE [dbo].[Service] SET [Addtime] = DATEADD(second,ABS(CHECKSUM(NEWID()))%DATEDIFF(second,@BDate,@Edate),@BDate)

  

标签:SET,59,datetime,修改,second,BDate,随机,EDate,MSSQL
来源: https://www.cnblogs.com/wxbug/p/11376683.html