Closed thamulansar closed 2 years ago
Deployment scripts should always error when a script errors. That way you know when something has gone wrong. Hence the code has -ErrorAction Stop
Do deal with this
Ultimately, think about what you are doing before raising non-issues.
$Command = "Invoke-Sqlcmd -ServerInstance '$Server' -Database '$Database' -InputFile '$SqlCmdFile' -OutputSqlErrors 1 -ErrorAction Stop";
Scenario : lets say 5 SQL insertion task is there inside the folder as 5 files. If issue with first SQL command file , Second command wont run and throw error example ::: Cannot insert duplicate key in object 'dbo.Table_TEST'. The duplicate key value
So next sql cmd wont run in the for loop.
Please have a check. Thanks