Closed csdunaway closed 3 years ago
The last build that worked with this command, is 1.0.60
There is an easy code fix I haven't had time to submit as a bug fix Replace $firstline -split $Delimiter | ForEach-Object { $ColumnMap.Add($PSItem, $PSItem) } with $firstline = Get-Content -Path $file -TotalCount 1 -ErrorAction Stop $ColumnMapping = @{ } $firstline -split $Delimiter | ForEach-Object { $ColumnMapping.Add($, $) } $ColumnMap += $ColumnMapping
Can you clarify your post @csdunaway ?
but the last 3 builds have been broken
So were you using build 1.0.108 and it worked? Your latest post states that it doesn't work after build 1.0.60...that is from 7+ months ago.
If this worked in previous builds then the test should be updated to prevent it from breaking again...
Same problem here. Upgraded from 1.0.61 to 1.0.112 and when I try to import a CSV it gives me the same header error. Reverted back to .61 and it's fine.
Verified that it still exists in 1.0.124 and 1.0.128. Observed in Windows PowerShell 5.1 and PowerShell 7.0.3
Please provide a csv file that receives this error so that we can probably reproduce it.
Here you go.
Hey @dsolodow, @dpo007 and @csdunaway could you test out PR #7210 and let me know if it fixes your issues - and that there are no regressions!
Thanks
This is fixed fa sho in v1.1.2
While attempting to import a .csv file into a database, I have received this error for the last 3 versions. I am currently running version 1.0.111
This is the full command I am using: Import-DbaCsv -Path 'C:\Temp\TempData.csv' -SqlInstance $ServerName -Database FirePowerData -ParseErrorAction AdvanceToNextLine -SkipEmptyLine -Table TempData
Environmental information
SQL Server:
Microsoft SQL Server 2016 (SP2-CU12) (KB4536648) - 13.0.5698.0 (X64) Feb 15 2020 01:47:30 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: )
Report
Yes, I have tested this in the Powershell command.
Host used
If anything other than powershell.exe was used, please confirm that you can duplicate the issue with powershell.exe
Errors Received
Steps to Reproduce
Import-DbaCsv -Path 'C:\Temp\TempData.csv' -SqlInstance 'RWR-SQL-00-IG' -Database FirePowerData -ParseErrorAction AdvanceToNextLine -SkipEmptyLine -Table TempData
Expected Behavior
I expected success. It used to work with earlier builds, but the last 3 builds have been broken.
Actual Behavior
WARNING: [10:41:06][Import-DbaCsv] Failure | '"DestinationPort"' field header not found. Parameter name: name