Skip to content

Commit f4e22da

Browse files
Merge pull request #3 from PinkDuck/patch-1
Fix null parameter defaults and collation support
2 parents 8e60793 + 4038065 commit f4e22da

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

indexes/dba_indexDefrag_sp.sql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,23 @@ BEGIN
441441
IF @scanMode NOT IN ('LIMITED', 'SAMPLED', 'DETAILED')
442442
SET @scanMode = 'LIMITED';
443443

444+
IF @executeSQL IS NULL
445+
SET @executeSQL = 0;
446+
444447
IF @debugMode IS NULL
445448
SET @debugMode = 0;
446449

447450
IF @forceRescan IS NULL
448451
SET @forceRescan = 0;
452+
453+
IF @minPageCount IS NULL
454+
SET @minPageCount = 8;
449455

450456
IF @sortInTempDB IS NULL
451457
SET @sortInTempDB = 1;
452458

459+
IF @onlineRebuild IS NULL
460+
SET @onlineRebuild = 0;
453461

454462
IF @debugMode = 1 RAISERROR('Undusting the cogs AND starting up...', 0, 42) WITH NOWAIT;
455463

@@ -592,7 +600,7 @@ BEGIN
592600
, 0 -- not scanned yet for fragmentation
593601
FROM sys.databases AS d
594602
JOIN dbo.dba_parseString_udf(@database, ',') AS x
595-
ON d.name = x.stringValue
603+
ON d.name COLLATE database_default = x.stringValue
596604
WHERE [name] NOT IN ('master', 'tempdb')-- exclude system databases
597605
AND [state] = 0 -- state must be ONLINE
598606
AND is_read_only = 0; -- cannot be read_only
@@ -1040,4 +1048,4 @@ BEGIN
10401048

10411049
SET NOCOUNT OFF;
10421050
RETURN 0;
1043-
END
1051+
END

0 commit comments

Comments
 (0)