Share Link
Copied to clipboard
Embed on Your Page
Copied to clipboard
We Stand with Ukraine
EF.Plus - Batch Delete - Executing Interceptor (EF Core) by ZZZ Projects

DECLARE @stop int
DECLARE @rowAffected INT
DECLARE @totalRowAffected INT

SET @stop = 0
SET @totalRowAffected = 0

WHILE @stop=0
    BEGIN
        DELETE TOP (4000)
        FROM    A 
        FROM    [Customers] AS A
                INNER JOIN ( SELECT [c].[CustomerID]
FROM [Customers] AS [c]
                           ) AS B ON A.[CustomerID] = B.[CustomerID]

        SET @rowAffected = @@ROWCOUNT
        SET @totalRowAffected = @totalRowAffected + @rowAffected

        IF @rowAffected < 4000
            SET @stop = 1
    END

SELECT  @totalRowAffected
Cached Result
Last Run: 10:52:33 am
Compile: 0.073s
Execute: 1.57s
Memory: 78.77Mb
CPU: 1.643s