select cast(ceiling(rand(checksum(newid()))*10) as int) as RndId from 表名 转载于:https://www.cnblogs.com/jasonlam/p/7765376.html