I need to generate random numbers in SQL Server and write these codes into the table. I used the SQL statement as follows:
while (select count(code) from tb_random) <1000000
begin
SET NOCOUNT ON
declare @r int
set @r = rand()*10000000
insert into tb_random values(@r)
end
It takes over 20h to complete this query. Could you give me an idea to solve this performance problem?
Aucun commentaire:
Enregistrer un commentaire