Index Optimize & Update Stats Error on external tables
Msg 46519, Update Statistics are not supported with external tables. [SQLSTATE 42000] (Error 50000)
SQL Server 2019 Developer Edition
Version of the script 2020-01-26 14:06:53
What command are you executing? EXECUTE dbo.IndexOptimize @Databases = 'USER_DATABASES', @FragmentationLow = NULL, @FragmentationMedium = NULL, @FragmentationHigh = NULL, @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'N', @LogToTable='Y'
What output are you getting? Msg 46519, Update Statistics are not supported with external tables. [SQLSTATE 42000] (Error 50000)
I am getting this issue as well. Other than excluding the external tables in the job definition, are there any other options?
While trying to figure this out, found this: Create Statistics
Essentially, UPDATE STATISTICS isn't supported. If you want to rebuild them, it must be a DROP and CREATE.
So, I'd see two options here:
- Ignore External Tables
- Drop and Create
Guess the question is, what would we like to see from an update to the code? Do we want to provide both options or just 1? Could see a new parameter '@ExternalTables' with options for 'RECREATE' or 'IGNORE' with the default being 'RECREATE'.
Thoughts?
@olahallengren , I have a script I am testing to resolve these issues. I am unable to publish my branch and/or create a pull request for the changes. If my code works, what is the process for getting it reviewed and put into the main repository?
I've submitted pull request to resolve this issue:
https://github.com/olahallengren/sql-server-maintenance-solution/pull/645