• declare tmpcursor cursor for

    select 'kill ' + convert(varchar, spid) as spid

    from master..sysprocesses

    where db_name(dbid) = @dbname

    and spid <> @@spid

    and dbid <> 0

    Markus out of curiosity, is there a reason to not apply this to only those processes with a spid > 49? The lower ones are system processes. I realise that set single user is the better alternative but I was merely wondering.

    ----------------------------------------------------