I'm trying to change a column data type from datetime2
to datetimeoffset
. I have db owner permissions.
Whenever I run the query:
alter table dbo.<my-table>
alter column [TimeStamp] datetimeoffset
I get the following error message:
The statistics 'Stat_a41cbd7f968a4cba86199c960f6f7c3a' is dependent on column 'TimeStamp'.
ALTER TABLE ALTER COLUMN TimeStamp failed because one or more objects access this column.
However, it looks like this statistic 'Stat_a41cbd7f968a4cba86199c960f6f7c3a' is not present in my sys.stats
table, which is very odd.
Is there any other location it might be defined?
Edit: There isn't a single entry in sys.stats
named 'Stat_a41cbd7f968a4cba86199c960f6f7c3a'. In addition, I have never defined any custom statistics other than the automatic ones.
Best Answer
After reaching out to Azure support, I have managed to solve the issue.
Part of the support engineer's answer included the following:
I was able to confirm and fix this issue by doing the following steps:
After that, the
ALTER TABLE
statement worked as expected.