How to kill the process id''s

  •  

    Hi,

    Iam Sridhar Babu. i have one issue regarding SQLServer2000.

    iam installing .net application with backend MS SQL Server2000.

    it is working fine.

    when ever i acccess database through application, for each connecation one process will create. and when i close the application the process are closed automatically.

    but the process are going to sleeping mode.

    my problem is when i am going to uninstall the application

    it is showing the error message.

    Error 27506.

    Cannot frop the database 'database name ' because it is currently in use[3702]

    this is done with the help of Install Shield package.

    Please help me how to do this problem through programmatically. 

    BABU

    B.Sridhar Babu SE
    Canarys automations P ltd
    #135 7th Main, 4th Block
    Jayanagar
    Bangalore-560011
    sridhar.bandalamudi@ecanarys.com Tel: +91-26539915-24
    Mobile: +91-9449631468

  • This was removed by the editor as SPAM

  • Try this code below.

    DECLARE @spid int

    declare @STR NVARCHAR(50) 

     
    DECLARE Cursor1 CURSOR FAST_FORWARD FOR SELECT spid

     FROM master..sysprocesses with(nolock)

     where hostname <> '' and cmd = 'Awaiting Command' and program_name = '.NET SqlClient Data Provider'

    OPEN Cursor1

    FETCH NEXT FROM Cursor1 INTO @spid

    WHILE @@FETCH_STATUS = 0

      BEGIN

     SET @STR = 'KILL ' + CONVERT(VARCHAR,@SPID) 

     EXEC SP_EXECUTESQL @STR  

      FETCH NEXT FROM Cursor1 INTO @spid

      END

    CLOSE Cursor1

    DEALLOCATE Cursor1

  • Please do not cross post. I answered your first thread: http://qa.sqlservercentral.com/forums/shwmessage.aspx?forumid=145&messageid=247419

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply