Hello Yernaidu !
Thank you for posting on Microsoft Learn.
In your case, partial rows can remain in the RAW table if the Copy Activity fails midway.
ADF Copy Activity is not transactional and it does not rollback partial inserts automatically if a failure occurs. That means if 4000 out of 10000 records are copied before failure, those 4000 will remain in the target table (RAW).
You can copy into a staging table (RAW_Staging) and once the copy completes successfully, validate row count/hash/.... Then, use a Stored Procedure with a transaction to move to RAW.
You can avoid reprocessing incomplete loads by marking successful files with a .complete or .success flag in ADLS and add assertions or row count checks post-copy before moving to next activity.
Will partial rows remain in the CLN table?
I can say that it depends on how your stored procedure is written.
By default, if you don’t wrap your T-SQL logic in a transaction, partial inserts can remain.
For example if the procedure inserts 5000 rows and crashes at row 5001, those 5000 remain unless a transaction was explicitly used.
As a best practice, you can use explicit transactions in your stored procedure:
BEGIN TRY
BEGIN TRANSACTION;
INSERT INTO CLN (...)
SELECT ... FROM RAW;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
THROW;
END CATCH
and you can validate data quality before insert by using a staging table or CTEs to filter or quarantine bad rows and doing integrity checks in a separate step before insert.
For retry and error handling in ADF keep in mind that you can :
- ADF copy activity: you can configure Retry policy in activity settings (for example 3 retries with interval) and set Fault tolerance (skip incompatible rows, log to bad records table).
- Stored procedure activity: you can wrap logic in TRY/CATCH with proper rollback or use Lookup + If Condition to skip reprocessing if data already exists or failed previously.
As a global pattern, you can implement a load tracking table with metadata (like file name, row count, load status) and you only mark files as processed after full success.