I understand from various sources on the internet that the following sql:
insert into mainTable(status)
output inserted.mainid into tmpTable(TARGET_ID)
select '0' from impTable
order by impid asc;
doesn't guarantee that the rows will be inserted in the mainTable in the order specified by the 'order by' in the select statement, although the values in the mainTable identity column (mainid) will be in the correct sequence.
My question is how this affects the inserted.mainid that is output into the tmpTable. Will they be added to the tmpTable in the order rows are inserted in the mainTable or will they folllow the sequence of the generated mainid identity values?
Nevermind the usefulness of the SQL, it's a technical question.
EDIT: Fixed the column missmatch in the SQL example