First 1000 Prime Numbers with SQL Server

前端 未结 3 1623
刺人心
刺人心 2021-01-23 18:04

I got program for Prime which gives only 2 as output. It should give me all based on java program I wrote.

Here is SQL I have created for Prime numbers. It is in SQL Ser

3条回答
  •  难免孤独
    2021-01-23 18:44

    To answer the question you asked:

    Can you please let me know the issue in this code?

    The problem with your code is that you never reset @i back to 1 when you iterate to the next value of @j.

            ...
            END
            SET @i = 1   --add this line to fix it
            SET @j += 1
            ...
    

提交回复
热议问题