-
-
Notifications
You must be signed in to change notification settings - Fork 857
Description
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
I've noticed that when Import-DbaCsv is executed, sql connection get closed.
Is it an expected behavior?
Also when I need to import in a specific database I need to specify in sql connection, it seems that "-Database" parameter get ignored
Steps to Reproduce
$Sqlconnection = Connect-DbaInstance -SqlConnectionOnly -SqlInstance $DefaultSqlServer -TrustServerCertificate -NonPooledConnection -StatementTimeout 0 -EncryptConnection -AppendConnectionString "Integrated Security=True;Multiple Active Result Sets=False"
$Sqlconnection .Open()
Import-DbaCsv -SqlInstance $Sqlconnection -Database $DBName -Table $Table -Schema "dbo" -Path $DataTable -NoProgress -AutoCreateTable
$Sqlconnection .State
(Closed)
Please confirm that you are running the most recent version of dbatools
2025.12.4
Other details or mentions
No response
What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe), Windows PowerShell ISE (powershell_ise.exe)
PowerShell Host Version
5.1
SQL Server Edition and Build number
2022
16.0.4222.2
.NET Framework Version
4.8.1