SPRZEDAŻ: 1-800-867-1389
Ta zawartość nie jest dostępna w wymaganym języku. Wersja w języku angielskim znajduje się tutaj.

KILL (Azure SQL Database)

This topic is OBSOLETE. You can find the most current version in the SQL 14 Transact-SQL Reference.

This topic is not maintained. For the current version, see KILL (Transact-SQL).

Terminates a user session in the current database that is based on the session ID. In Microsoft Azure SQL Database, the KILL statement can only be used to terminate sessions of the database the user is logged into. If the specified session ID has a lot of work to undo, the KILL statement may take some time to complete, particularly when it involves rolling back a long transaction.

Syntax Conventions (Azure SQL Database)

KILL { session ID } [ WITH STATUSONLY ] 

This syntax diagram demonstrates the supported arguments and options in Microsoft Microsoft Azure SQL Database. Microsoft Azure SQL Database does not support the UOW (unit of work) argument when using the KILL statement.

session ID
Is the session ID of the process to terminate. session ID is a unique integer (int) that identifies a session in the database the user is connected to.The session ID value is tied to the connection for the duration of the connection. When the connection ends, the value is released and can be reassigned to a new connection.

Generates a progress report about a specified session ID that is being rolled back due to an earlier KILL statement. KILL WITH STATUSONLY does not terminate or roll back the session ID; the command only displays the current progress of the rollback.

For more information about the arguments and the KILL statement, see KILL (Transact-SQL) in SQL Server Books Online.

Requires the KILL DATABASE CONNECTION permission. This permission is implied by the CONTROL database permission and the ALTER ANY CONNECTION server permission.

A. Using KILL to terminate a session

The following example shows how to terminate session ID 53.

KILL 53;

B. Using KILL session ID WITH STATUSONLY to obtain a progress report

The following example generates a status of the rollback process for the specific session ID.

KILL 54;

--This is the progress report.
spid 54: Transaction rollback in progress. Estimated rollback completion: 80% Estimated time left: 10 seconds.

Czy oceniasz te materiały jako pomocne?
(Pozostało znaków: 1500)
Dziękujemy za opinię.

Zawartość społeczności

© 2014 Microsoft