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)

  

上一篇:pyodbc连接MSSQL执行SQL语句


下一篇:【MSSQL巡检】SQL Server巡检