place these formulas side by side in two columns..
=LEFT($A1,FIND(" ",$A1)-1)
=RIGHT($A1,FIND(" ",$A1)-1)
=LEFT($A1,FIND(" ",$A1)-1)
DECLARE @batchSize INT
SET @batchSize = 10000
WHILE (SELECT COUNT(*) FROM yourTable WHERE yourCondition) > 0
BEGIN
DELETE FROM yourTable
WHERE primaryKey IN ( SELECT TOP ( @batchSize )
primaryKey
FROM yourTable
WHERE yourCondition ) ;
END ;
of course using EXISTS is faster:
USE master
go
DECLARE @dbname sysname
SET @dbname = 'yourdbname'
DECLARE @spid int
SELECT @spid = min(spid)
from master.dbo.sysprocesses
where dbid = db_id(@dbname)
WHILE @spid IS NOT NULL
BEGIN
EXECUTE ('KILL ' + @spid)
SELECT @spid = min(spid)
FROM master.dbo.sysprocesses
WHERE dbid = db_id(@dbname)
AND spid > @spid
END
Using CTRL + ALT + DEL on Remote Desktop (hint...its really ctrl+alt+end)