I'm using sp_blitzindex v6.7 on Sql Server 2016(13.0.4451.0), I am intermittently having issues with running it through powershell using invoke-sqlcmd. It happens consistently with the same databases on the same servers.
When it fails it gives me this error:
database failed to process. The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
It runs just fine on those databases in SSMS. I've checked the db properties to make sure it isn't compatibility level or something, as well as tried the powershell script using other databases on the same server and they work.
There's no consistency as to the results being returned - when run in SSMS for the databases that fail in powershell, some will return results and some will not.
It's not really blocking me from doing what I am trying to, but just wondered if anyone had seen this before.