-
-
Notifications
You must be signed in to change notification settings - Fork 859
Description
Summarize Functionality
When using Import-DbaCsv -AutoCreateTable to import multiple CSV files into the same table, the post-import column optimization (Optimize-ColumnSize) shrinks nvarchar(MAX) columns to fit the data from the first file. Subsequent imports then fail if later CSV files contain longer values in those columns.
A -NoColumnOptimize switch would skip the Optimize-ColumnSize step, leaving columns at nvarchar(MAX) so that all files can import successfully. This restores the old pre-optimization behavior on demand for multi-file import scenarios.
Is there a command that is similiar or close to what you are looking for?
Yes
Technical Details
The Optimize-ColumnSize function (in Import-DbaCsv.ps1) runs automatically after commit when $createdFatTable is true. The proposed change adds a [switch]$NoColumnOptimize parameter that, when set, suppresses the two Optimize-ColumnSize call sites (transaction and no-transaction paths around lines 1439 and 1452).
I'm planning to implement this and submit a PR.