We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
CREATE TABLE t (
Colm int,
);
declare @x int =2
declare @i int
declare @b int
declare @z int
while @x >=2 and @x<=1000
begin
set @i=@x
set @b=2
set @z=0
while @b < @i
begin
if @i%@b=0
set @z=@z+1
set @b=@b+1
end
if @z=0
INSERT INTO t (colm) VALUES (@i);
Print Prime Numbers
You are viewing a single comment's thread. Return to all comments →
CREATE TABLE t ( Colm int, ); declare @x int =2 declare @i int declare @b int declare @z int while @x >=2 and @x<=1000 begin set @i=@x set @b=2 set @z=0 while @b < @i begin if @i%@b=0 set @z=@z+1 set @b=@b+1 end if @z=0 INSERT INTO t (colm) VALUES (@i);
end select STRING_AGG(colm, '&') clom from t