SQLServerPSModule
SQLServerPSModule copied to clipboard
Write-SQLTableData - Progress action floods interactive consoles
The progress of the Write-SQLTableData function floods interactive consoles and memory. On PS5 it’s not possible to suppress the progress.
Or may be a way we don’t know?
Hi @DennisBergemann,
I would suggest a couple of options:
- Feed the cmdlet either a DataTable or a DataSet object
- Before running the cmdlet, consider setting
$ProgressPreference = 'SilentlyContinue'
For (1), that a generally good idea [when possible]. For example, avoid
# Insert
$LongArray = 1..1000
$LongArray | Write-SQLTableData -ServerInstance SQL3 -DatabaseName tempdb -TrustServerCertificate -SchemaName dbo -TableName T1 -Force
instead use either
$LongArray = 1..1000
# Note the little comma before the array
,$LongArray | Write-SQLTableData -ServerInstance SQLS3 -DatabaseName tempdb -TrustServerCertificate -SchemaName dbo -TableName T1 -Force
or
$LongArray = 1..1000
# Avoid the pipeline and use -InputData
Write-SQLTableData -ServerInstance SQL3 -DatabaseName tempdb -TrustServerCertificate -SchemaName dbo -TableName T1 -Force -InputData $LongArray
If you have any more specific example, where neither (1) nor (2) help, let me know...