set @string = '1.01'
select 'test' as col1,
case
WHEN ISNUMERIC(@string) = 0 THEN 0
WHEN @string LIKE '%[^-+ 0-9]%' THEN 0
WHEN CAST(@string AS NUMERIC(38, 0))
NOT BETWEEN -2147483648. AND 2147483647. THEN 0
ELSE 1
end as intCol
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