Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hello,
I am currently working with Microsoft Fabric Warehouse and attempting to use the MERGE SQL statement to perform upserts (insert/update operations). However, it seems that the MERGE statement is currently not supported in Fabric's warehouse SQL engine.
Could someone from the Microsoft team or the community provide clarification on:
This feature is quite essential for many data integration and ETL/ELT scenarios, and I’m sure many users would benefit from knowing the roadmap or alternatives.
Thanks in advance for your help!
Solved! Go to Solution.
MERGE support is planned as part of ongoing SQL capabilities improvements in Fabric Warehouse, but:
You can follow updates on:
You can follow updates on:
Workarounds for MERGE in Fabric Warehouse
Until MERGE is available, you can replicate its behavior with manual UPSERT logic using a combination of UPDATE and INSERT with NOT EXISTS.
-- 1. UPDATE existing records
UPDATE target
SET target.column1 = source.column1,
target.column2 = source.column2
FROM target_table AS target
JOIN staging_table AS source
ON target.primary_key = source.primary_key;
-- 2. INSERT new records
INSERT INTO target_table (primary_key, column1, column2)
SELECT source.primary_key, source.column1, source.column2
FROM staging_table AS source
LEFT JOIN target_table AS target
ON target.primary_key = source.primary_key
WHERE target.primary_key IS NULL;
Tip: If your tables are large, consider indexing your join keys and/or breaking up operations into batches for performance.
Alternative: ELT with Dataflows Gen2 + Notebooks
If you're orchestrating pipelines in Fabric:
Hi @FabricTrailLear ,
We would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Regards,
B Manikanteswara Reddy
Hi @FabricTrailLear ,
We would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Regards,
B Manikanteswara Reddy
MERGE support is planned as part of ongoing SQL capabilities improvements in Fabric Warehouse, but:
You can follow updates on:
You can follow updates on:
Workarounds for MERGE in Fabric Warehouse
Until MERGE is available, you can replicate its behavior with manual UPSERT logic using a combination of UPDATE and INSERT with NOT EXISTS.
-- 1. UPDATE existing records
UPDATE target
SET target.column1 = source.column1,
target.column2 = source.column2
FROM target_table AS target
JOIN staging_table AS source
ON target.primary_key = source.primary_key;
-- 2. INSERT new records
INSERT INTO target_table (primary_key, column1, column2)
SELECT source.primary_key, source.column1, source.column2
FROM staging_table AS source
LEFT JOIN target_table AS target
ON target.primary_key = source.primary_key
WHERE target.primary_key IS NULL;
Tip: If your tables are large, consider indexing your join keys and/or breaking up operations into batches for performance.
Alternative: ELT with Dataflows Gen2 + Notebooks
If you're orchestrating pipelines in Fabric:
Check out the March 2025 Fabric update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
6 | |
2 | |
1 | |
1 | |
1 |