Re: Cancelling a Query/Procedure

From: Tyler D. Muth <tyler_muth_at_hotmail.com>
Date: 4 Aug 2002 08:59:38 -0700
Message-ID: <1afec35e.0208040759.17c87cc8_at_posting.google.com>


nicolasdemarco <> wrote in message news:<1624582.1028325587_at_dbforums.com>...
> Dear Mike: sorry for my english, but i'm from Argentina.
>
> Unfortunetly I d'ont know the answer to your question, but I ned to know
> how do you allow cancellation of a SQL statement with ADO. I am working
> with Delphi and ADO Objects and an SQL Server Database. I need to cancel
> a large query by press a Cancel button. Also should be nice to show the
> user a Progress Bar showing the progress of the query.
>
> I had read the Microsoft documentation of ADO, and I know that the
> commands must by Asyncronous.
>
> Please, can you send me the VB (or an other languaje) statements to
> implement such cancellation ?
>
> Thank you very much
>
> Nicolas

You need to kill the session of the tool that executed the query.

  1. Connect as SYS (yes, you have to connect as sys)
  2. Run the following query: set linesize 125 set pagesize 100

column username format a15;
column osuser format a15;
column kill format a40;

select username,osuser,terminal,to_char(LOGON_TIME,'MMDD HH24:MI') logondate, 'alter system kill session ''' || sid || ','|| serial# ||''';' kill from sys.v$session order by 3;

3. Find the terminal and user that is running the offending query. 4. Copy the corresponing 'ALTER SYSTEM KILL SESSION ...' line and copy it.
5. Paste and execute it.

Poof! Query stopped. Hope this helps. Received on Sun Aug 04 2002 - 17:59:38 CEST

Original text of this message