I have a 2 query results that I load into 2 table variables A & B.
From using statements like these I have narrowed it down to where the delay occurs
SET @end_t = GETDATE()
SET @ms = DATEDIFF(ms, @start_time, @end_t)
PRINT ' Query for Table B data - milsecs ' + CAST(@ms as Varchar(15))
declare @B table ( LN int, Customer varchar(25), pF int);
insert into @B(LN,customer, pF)
I found that the Query itself ( select ) when instrumented is taking 1+ second
But inserting it into the table variable is tripling the time. (My test case only returns 20 records)
Any ideas on why... or an alternate approach.