I have the following temp table which gets populated with between 1,000,000 and 10,000,000 rows after it has been created.
Which is for efficient, to add the PK after we insert the rows or before we insert the rows?
create table #CallsToBill (
CallID char(15) COLLATE Latin1_General_BIN NOT NULL,
CallCost numeric (9, 7) NOT NULL,
CallTax numeric (9, 7) NOT NULL,
CallTotal numeric (9, 7) NOT NULL,
StartTime datetime NOT NULL,
Direction char(1) NOT NULL,
Period varchar(50) NOT NULL
ALTER TABLE #CallsToBill ADD PRIMARY KEY (CallID)