SELECT TOP 100 id = identity(int,1,1) INTO # FROM syscolumns a, syscolumns b select top 1 id from # where id>=50 order by newid()drop table #
declare @a int set @a=(SELECT convert(int,RAND( (DATEPART(mm, GETDATE()) * 100000 ) + (DATEPART(ss, GETDATE()) * 1000 ) + DATEPART(ms, GETDATE()) )*100)) if @a<50 begin select @a+50 end else begin select @a end
id = identity(int,1,1)
INTO # FROM syscolumns a, syscolumns b
select top 1 id from # where id>=50 order by newid()drop table #
set @a=(SELECT convert(int,RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE()) )*100))
if
@a<50
begin
select @a+50
end
else
begin
select @a
end