I am trying to refresh some tables in our data warehouse from the live production database and I am using Merge (for transactional tables that change data per record) and Insert (for historical/log tables).
I am curious to see what is the difference between using the structures below in terms of affecting the source database? I would need to be able to avoid blocking other sessions in the production database while this refresh is going on.
WITH SRC AS (
SELECT <field1>,<field2>,etc
FROM [LINKED SERVER].<Schema>.dbo.<DBName>
WHERE ModifiedDate > @LastModifiedDate
)
INSERT INTO DW (<field1>,etc.)
SELECT <field1>,etc.
FROM SRC
Versus
INSERT INTO DW (<field1>,etc.)
SELECT <field1>,etc.
FROM [LINKED SERVER].<Schema>.dbo.<DBName>
WHERE ModifiedDate > @LastModifiedDate
Thank you.