FIX: No error is prompted when connection is terminated in sqlcmd

Symptoms
Assume that you use the sqlcmd utility to connect to a remote instance of Microsoft SQL Server 2012 or SQL Server 2014 and run a query with the -Q and -b option. When the sqlcmd connection is terminated unexpectedly before the query is finished, the exit code of sqlcmd indicates success.

Note
  • The expected outcome is that when the sqlcmd connection is terminated, an error message is reported by sqlcmd that indicates that the connection is lost and the exit code is 1 that indicates failure.
  • The sqlcmd connection can be terminated in these ways: the SQL Server KILL command, SQL Server service shutdown, SQL Server restart during patching, network issues, and others.
Resolution
After you apply this update, an error message together with severity 19 is sent back for the conditions described previously.

The issue was first fixed in the following cumulative update of SQL Server: Recommendation: Install the latest cumulative update for SQL Server
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. We recommend that you download and install the latest cumulative updates for SQL Server:
Workaround
To work around this issue, use -i option instead of -Q option in sqlcmd to specify a query file that contains multiple query batches.
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Свойства

ИД на статията: 3082877 – Последен преглед: 12/22/2015 02:46:00 – Редакция: 4.0

Microsoft SQL Server 2012 Service Pack 2, Microsoft SQL Server 2014 Service Pack 1, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Standard

  • kbqfe kbfix kbexpertiseadvanced kbsurveynew KB3082877
Обратна връзка