-
-
Save anonymous/b49c1e70c8188059be51 to your computer and use it in GitHub Desktop.
Deletes fine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE dbo.ThisWorksFine | |
( | |
StupidSK int IDENTITY(1,1) NOT NULL PRIMARY KEY | |
, BatchId int | |
, Value nvarchar(50) | |
); | |
-- (422500 row(s) affected) | |
-- 24 seconds | |
INSERT INTO dbo.ThisWorksFine | |
( | |
BatchId | |
, Value | |
) | |
SELECT | |
10 AS BatchId | |
, LEFT(C.name,50) AS Value | |
FROM | |
sys.columns AS C | |
CROSS APPLY | |
sys.columns AS C2; | |
-- (422500 row(s) affected) | |
-- 24 seconds | |
INSERT INTO dbo.ThisWorksFine | |
( | |
BatchId | |
, Value | |
) | |
SELECT | |
30 AS BatchId | |
, LEFT(C.name,50) AS Value | |
FROM | |
sys.columns AS C | |
CROSS APPLY | |
sys.columns AS C2 | |
-- (1267500 row(s) affected) | |
-- 1:24 | |
INSERT INTO dbo.ThisWorksFine | |
( | |
BatchId | |
, Value | |
) | |
SELECT | |
50 AS BatchId | |
, LEFT(C.name,50) AS Value | |
FROM | |
sys.columns AS C | |
CROSS APPLY | |
sys.columns AS C2 | |
CROSS APPLY | |
sys.tables AS T | |
-- 2112500 | |
SELECT COUNT_BIG(1) AS rc FROM dbo.ThisWorksFine AS TWF | |
SELECT CAST(CURRENT_TIMESTAMP AS datetime2(7)) AS StartTime; | |
DELETE TWF | |
FROM | |
dbo.ThisWorksFine AS TWF | |
WHERE | |
TWF.BatchId = 30; | |
SELECT CAST(CURRENT_TIMESTAMP AS datetime2(7)) AS StopTime; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment