Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid column name 'stats_sample_rate' #1

Open
a-bolanos opened this issue Oct 25, 2021 · 1 comment
Open

Invalid column name 'stats_sample_rate' #1

a-bolanos opened this issue Oct 25, 2021 · 1 comment

Comments

@a-bolanos
Copy link

Hi! thanks for this great code! I was testing the stored procedure dbo.[StatsOptimize] and it is failing with this error:

Invalid column name 'stats_sample_rate'

I'm using these parameters:

exec dbo.[StatsOptimize] @Tables=null, @StatisticsModificationLevel=null, @StatisticsSample=null ,@OnlyModifiedStatistics=null,@DeleteOverlappingStats=null, @TimeLimit=null , @Execute='N'

I think the error comes when the code tries to UNION the results from dbo.vStats and dbo.vTableStats because the column stats_sample_rate does not exists in dbo.vStats.

@CMangrum
Copy link

CMangrum commented Nov 30, 2021

EDIT: I believe if you add vs.stats_sample_rate to the SELECT in the vStats view it corrects the error. In MaintenanceSolution.sql I inserted this on line 162:
, vs.stats_sample_rate


I'm getting the same error when trying to execute. Here is the output from when I ran it with @execute = 'N', but I've also tried it with @execute = NULL and get the same result.
Date and time: 2021-11-30 15:41:17
Server: removed
Version: 10.0.13665.0
Edition: SQL Azure
Parameters: @tables= 'ALL', @OnlyModifiedStatistics = 'Y', @StatisticsModificationLevel = NULL, @StatisticsSample = NULL, @DeleteOverlappingStats = N, @Timelimit = NULL, @execute = N
Version: Microsoft Azure SQL Data Warehouse - 10.0.13665.0 Nov 8 2021 19:18:05 Copyright (c) Microsoft Corporation
Source: https://github.com/ProdataSQL/SynapseTools/tree/main/SqlPools/Maintenance

Msg 207, Level 16, State 1, Line 1
Invalid column name 'stats_sample_rate'.
Invalid column name 'stats_sample_rate'.
Invalid column name 'stats_sample_rate'.
Invalid column name 'stats_sample_rate'.

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

No branches or pull requests

2 participants