
Error: Process ID %d is not an active process ID
Tomer,
What this code tries to do is disconnect all the active processes from the
database before it detaches it (you can't detach a database with active
connections). What might cause the error is between the time that the cursor
is created and the process is killed using the 'kill' statement, it is
already killed in another way (for example bu the user who started the
connection).
If you use SQL Server 2000 there is a lot easier way to achieve the goal of
IMMEDIATE'
You can find more inforamtion about ALTER DATABASE and its options in BOL.
hth
Jacco
Quote:
> Hi All,
> I'm runing stored procedure that contains the following:
> --------------------------------------------------------------------------
-
> begin
> declare spid_cursor cursor scroll for
> open spid_cursor
> begin
> end
> close spid_cursor
> deallocate spid_cursor
> end
> --------------------------------------------------------------------------
-
> It works good usually, but once in a while I get the following error:
> "Process ID %d is not an active process ID."
> Any idea what wrong? or what is the meaning of this error?
> Thanks in advanced,
> -Tomer