50340

KIll SQL Server SELECT statement?

Question:

I have a SELECT statement which is hanging and I would like to kill it. I am accessing the server through a SQL GUI if that matters (not microsoft's).

Is there a command I can execute to kill that process?

I get this when using EXEC('Kill ' + Pid):

<blockquote>

KILL command cannot be used inside user transactions.

</blockquote>

Answer1:

You could try the <a href="http://msdn.microsoft.com/en-us/library/ms173730%28v=sql.105%29.aspx" rel="nofollow">KILL</a> command.

Answer2:

If KILL command alone does not work, like you constantly get "<em>KILL command cannot be used inside user transactions.</em>" errors, then take your database OFFLINE and BACKONLINE again. This will force a full disconnect of any lingering processes on your database.

Do not do DEATTACH, as that is "overkill" and could jeapordise bringing your database back online.

If it's a production database, obviously <strong>think</strong> before you do this!

Recommend

  • move_uploaded_file warning
  • Why is the minimum size of a reference type 12 bytes for a 32 bit .NET process
  • Call base method instead of override
  • Why isn't eclipse deploying my Dynamic Web Project correctly?
  • How to validate empty string value tag in xsd
  • how to upgrade the prevoius apk with new apk without losing the previous data in android from unknow
  • Call to undefined function Illuminate\\Filesystem\\finfo_file()
  • Move an 8 bit image using VHDL
  • How to speak current latitude,longitude text into speech
  • Exception in thread “main” java.lang.NoSuchMethodError: scala.Predef$.refArrayOps( [duplicate]
  • Binding a combobox in subform Access
  • Mailkit Authenticate to Imap fails
  • How deleteLater() actually works in qt?
  • How to read config files with section in bash shell
  • Android sharing intent with google maps location and URL Shortener API
  • Zero downtime deployment Nodejs application
  • Does anyone know about Kephas?
  • Http Requests not getting routed to Https NodeJs
  • Salesforce consuming XML and display data in Visualforce report
  • PHP Append to Excel file
  • how to reload page after uploading images
  • jqGrid Filter Toolbar and Date and Select filters
  • Vue.js 2: Vue cannot find files from /assets folder (v-for)
  • Jenkins sending notifications to the wrong commit id
  • I need a PHP mySQL Login script that directs user to specific URL based on username and password
  • Sample deviceQuery cuda program
  • Adding native code to an existing Worklight hybrid app
  • Admob in ListView not clickable
  • How to check if a database and tables exist in sql server in a vb .net project?
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Create an average of multiple excel chart without the data source
  • VSTS work items list through REST API
  • How to decleare char *const argv[] in swift [duplicate]
  • Computing the discrete fourier transform of audio data with FFTW
  • Android Library Projects on Windows and Mac
  • Using Service Component Runtime
  • convert json to excel in java
  • Create/delete users from text file using Bash script
  • XSLT Transformation to validate rules in XML document