Skip to content

Conversation

@VladDBA
Copy link
Contributor

@VladDBA VladDBA commented Nov 24, 2025

This fix doesn't address the output object names, but I can tackle those those if needed as well.

Behavior with this fix:

/*These work*/
EXEC sp_BlitzIndex;
EXEC sp_BlitzIndex @GetAllDatabases = 1, @Mode = 0;
EXEC sp_BlitzIndex @GetAllDatabases = 1, @Mode = 1;
EXEC sp_BlitzIndex @GetAllDatabases = 1, @Mode = 2;
EXEC sp_BlitzIndex @GetAllDatabases = 1, @Mode = 3;
EXEC sp_BlitzIndex @GetAllDatabases = 1, @Mode = 4;
EXEC sp_BlitzIndex @DatabaseName = 'StackOverflow', @TableName = 'Users'; 
EXEC sp_BlitzIndex @DatabaseName = 'StackOverflow', @TableName = 'dbo.Users';
EXEC sp_BlitzIndex @DatabaseName = 'StackOverflow', @TableName = '[dbo].Users';
EXEC sp_BlitzIndex @DatabaseName = 'StackOverflow', @TableName = '[dbo].[Users]';
EXEC sp_BlitzIndex 'StackOverflow.dbo.Users';


/*all following variations work*/
EXEC sp_BlitzIndex @DatabaseName = '[Testing.1.2]';
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2'; 
EXEC sp_BlitzIndex '[Testing.1.2].[Very.Bad.Schema].[Very.Bad.Idea]'
EXEC sp_BlitzIndex @DatabaseName = '[Testing.1.2]', @TableName = '[Very.Bad.Schema].[Very.Bad.Idea]' 
EXEC sp_BlitzIndex @DatabaseName = '[Testing.1.2]', @SchemaName = 'Very.Bad.Schema', @TableName = 'Very.Bad.Idea'
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2', @SchemaName = 'Very.Bad.Schema', @TableName = 'Very.Bad.Idea'
EXEC sp_BlitzIndex @DatabaseName = '[Testing.1.2]', @SchemaName = '[Very.Bad.Schema]', @TableName = '[Very.Bad.Idea]'
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2', @SchemaName = '[Very.Bad.Schema]', @TableName = '[Very.Bad.Idea]'
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2', @SchemaName = '[Very.Bad.Schema]', @TableName = 'Very.Bad.Idea'
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2', @TableName = '[Very.Bad.Idea]'; /*will not work if the same table name exists in multiple schemas*/
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2', @TableName = 'Very.Bad.Idea'; /*will not work if the same table name exists in multiple schemas*/

/*This does not work due to not finding schema or object (at this point, this is the lesser evil) */
EXEC sp_BlitzIndex @DatabaseName = '[Testing.1.2]', @TableName = 'Very.Bad.Schema.Very.Bad.Idea';
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2', @TableName = '[Very.Bad.Schema].Very.Bad.Idea'; 
EXEC sp_BlitzIndex @DatabaseName = 'Testing.1.2', @TableName = 'Very.Bad.Schema.[Very.Bad.Idea]';


/*It doesn't error out, but it outputs Mode = 0 for the database in which sp_BlitzIndex lives, completely ignoring the input*/
EXEC sp_BlitzIndex 'Testing.1.2.Very.Bad.Schema.Very.Bad.Idea';

Copy link
Member

@BrentOzar BrentOzar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request! Looks good, merging into the dev branch, will get a release out tonight with it.

@BrentOzar BrentOzar merged commit 1a2f8db into BrentOzarULTD:dev Nov 25, 2025
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants