select * from sysprocesses
where dbid in (select dbid from sysdatabases where name='overtime')
and program_name ='PHP 5'
USE master
DECLARE @spid int
DECLARE CUR CURSOR
FOR SELECT spid FROM sysprocesses WHERE dbid = 11 and program_name ='PHP 5'
OPEN CUR
FETCH NEXT FROM CUR INTO @spid
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC ('KILL ' + @spid )
FETCH NEXT FROM CUR INTO @spid
END
CLOSE CUR
DEALLOCATE CUR