declare @a int,@b int,@i int set @i=1 while @i<100 begin set @a=2 set @b=0 while @a<=@i/2 begin if @i % @a=0 begin set @b=1 break end set @a=@a+1 end if @b=0 print @i set @i=@i+1 end