select '0000000000' as empid into #temp
declare @M int
set @M=100
declare @empid nvarchar(100)
while(@M>0)
begin
select @empid=max(empid) from (
select top (cast((rand()*@M) as int)) * from dbo.Users orderby empid)a
insert into #temp select@empid
set @M= @M-1
end
select * from#temp
drop table #temp
--dbo.Users结构 --> empid,empname
-- empid -->人员编号
--empname -->人员姓名
--@M -->总人数