FIX: "Invoke-sqlcmd" cmdlet executes a query statement multiple times if an error occurs in SQL Server 2014 or 2016

Applies to: SQL Server 2014 DeveloperSQL Server 2014 EnterpriseSQL Server 2014 Enterprise Core

Symptoms


You use the invoke-sqlcmd cmdlet to execute a query statement in an instance of SQL Server 2014 or 2016. However, if execution fails because of an error, the query statement is executed multiple times.

Resolution


This issue is fixed in the following cumulative updates for SQL Server:
 
    
    

 

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

 

References


Learn about the terminology that Microsoft uses to describe software updates.