I have a temporary table in my procedure; I tried to insert data from a select statement like this:
INSERT INTO #temptable
SELECT fee, expense, total FROM invoice
UNION
SELECT vat, holdingtax, total FROM uplifts
…but in my temptable, only the first select statement gets populated into the table, while the next select statement does not insert the data.
I assume the UNION is removing duplicated data.
I just made a test with union ALL:
and I got
(2 row(s) affected)try to replace UNION by UNION ALL