I am new to sql programming, I need help on insert statement. I need to insert a huge set of data(20 million rows) into a table, and the tempdb keep running out of space(we have about 2000 mb configure for tempdb). The insert statement go like this
declare @rowupdate int
set @rowupdate = 1
set rowcount 10000
while @rowupdate > 0
begin
insert into customers(cus_id,cus_lname, cus_fname, ss#)
select cus_id,cus_lname, cus_fname, ss# from site a join record b
on a.docid=b.docid
@rowupdate=@@rowcount
end
go
is there a way to minimize tempdb growth during insert process?
Thanks for your help