Nowaday not doing JDE anymore, but still touching some MSSQL T-SQL for time being, because of the stupid system and poorly implemented Database Design
i need to search and kill DB process which is not good
below is the syntax that use to kill process
use master
go
declare @spid int,@bl int
DECLARE s_cur CURSOR FOR
select 0 ,blocked
from (select * from sysprocesses where blocked>0 ) a where not exists(select * from (select * from sysprocesses where
blocked>0 ) b where a.blocked=spid)
union
select spid,blocked from sysprocesses where blocked>0 OPEN s_cur FETCH NEXT FROM s_cur INTO @spid,@bl WHILE @@FETCH_STATUS = 0 begin if @spid =0 select ‘deadlock: ‘+ CAST(@bl AS VARCHAR(10)) + ‘sql p:’
else
select ‘SPID:’+ CAST(@spid AS VARCHAR(10))+ ‘by’ + ‘SPID:’+ CAST(@bl AS
VARCHAR(10)) +’locksql’
DBCC INPUTBUFFER (@bl )
FETCH NEXT FROM s_cur INTO @spid,@bl
end
CLOSE s_cur
DEALLOCATE s_cur
Post Footer automatically generated by wp-posturl plugin for wordpress.