1

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.

  • 1
    You'll probably have more luck if you post the actual command you're using rather than just the error. I've never run into this issue, so it's either an artifact of your command or something local to the databases. – Erik Darling Jul 28 '18 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.