SQL Server 2008 R2 – Error Running sp_BlitzCache with Output DB, Schema, and Table

sp-blitzcachesql serversql-server-2008-r2

I am using sp_BlitzCache version 4.1 (20161210) and executing it on a 2008R2 instance (10.5.4042).

If I execute the sp without the @OutputDatabaseName, @OutputSchemaName, and @OutputTableName, it works fine. However, when I set those values, it runs through its process and at the very end, and error appears:

"The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns."

The specific statement I am running is:

EXEC [dbo].[sp_BlitzCache] @OutputDatabaseName = 'Maintenance_Stats'
,@OutputSchemaName = 'dbo'
,@OutputTableName = 'BlitzCacheResults'

The database, schema, and table already exist, but has no records in it. So…somewhere in the sp code, it created the table, but is trying to stuff too many values into the table.

I am using this to try to troubleshoot an application (SCCM) hang issue, and as recommended, have created a SQL Agent job that the helpdesk can execute when they encounter the issue (it is intermittent), but I tried executing it myself, and it failed with the above error.

Best Answer

The comments are right, but I figured I'd chime in. That is fixed in the latest release

Full disclosure: I am owned and operated by Brent Ozar Unlimited, and contributed both the bug and the bug fix to this code.

On my birthday.