Skip to content

Commit 4be96d4

Browse files
committed
#3356 Small change to temp table creation
1 parent 3e1b16a commit 4be96d4

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

sp_Blitz.sql

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,14 @@ AS
266266

267267
IF ISNULL(@SkipXPRegRead, 0) != 1 /*If @SkipXPRegRead hasn't been set to 1 by the caller*/
268268
BEGIN
269-
IF OBJECT_ID(N'tempdb..#XpRegReadTest') IS NULL
270-
BEGIN
271-
CREATE TABLE #XpRegReadTest
272-
(
273-
[Value] varchar(20)
274-
,[Data] int
275-
);
276-
END;
269+
IF OBJECT_ID(N'tempdb..#XpRegReadTest') IS NOT NULL
270+
EXEC sp_executesql N'DROP TABLE #XpRegReadTest;';
271+
272+
CREATE TABLE #XpRegReadTest
273+
(
274+
[Value] varchar(20)
275+
,[Data] int
276+
);
277277

278278
BEGIN TRY
279279
INSERT INTO #XpRegReadTest
@@ -292,12 +292,9 @@ AS
292292
END CATCH;
293293

294294
IF OBJECT_ID(N'tempdb..#XpRegReadTest') IS NOT NULL
295-
BEGIN
296-
DROP TABLE #XpRegReadTest;
297-
END;
295+
EXEC sp_executesql N'DROP TABLE #XpRegReadTest;';
298296
END; /*Need execute on xp_regread*/
299297

300-
301298
IF NOT EXISTS
302299
(
303300
SELECT

0 commit comments

Comments
 (0)