Hi ,
Thanks for reaching out to Microsoft Q&A.
Solution 1:
Use Auto-Create Tables with Flexible Schema Copy
- Enable "Auto Create" in Copy Activity
- In your Copy Activity, under the Sink Settings, enable:
- Auto create table: This will create missing tables automatically.
- Allow schema drift: This will allow changes in schema.
- Enable "Skip Incompatible Columns"
- Under Mapping, set the Skip incompatible columns option.
- This prevents errors due to missing or extra columns.
- Full Load (Truncate & Load) Strategy
- If you are truncating and reloading, the new schema will be considered automatically when reloading
Solution 2:
Use Mapping Data Flows with "Allow Schema Drift"
- Use a Mapping Data Flow instead of Copy Activity
- Add a Source transformation and enable Schema Drift to capture all columns dynamically.
- Use a Sink with Allow Schema Drift enabled, ensuring new columns flow without failures.
Solution 3:
Use "Stage and Merge" Strategy
Load into a Staging Table (with dynamic structure)
- Instead of loading directly, copy into a wide, flexible staging table.
- The staging table should use a JSON or XML column for unexpected columns.
Use MERGE with Dynamic SQL
- Load data into the main table after validating the schema dynamically.
Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.