1.更新表中某个字段为随机值
update [Courses] set LearnsNum = cast(rand(checksum(newid()))*(999-100)+100 as int)
以下可参考,非原创
update [test].[dbo].[table] set [table.rand] = cast(rand(checksum(newid()))*(999999-100000)+100000 as float(6)) select newid() 如:57C26BA5-8304-4877-B5D4-256C80428B94 select rand() 如:0.029051900701824 select checksum(500) 如:500 select checksum(newid()) 如:35757911 select rand(checksum(newid())) 如:0.657911662715189 select rand(checksum(newid()))*(999999-100000)+100000 如:881621.124049528 select cast(rand(checksum(newid()))*(999999-100000)+100000 as float(6)) 如:609545.7
生活最终回归平淡