Recently I have dropped all automatically created statistics (named _WA_Sys_%) and run the following T-SQL command to create statistics for all columns of the database :
EXEC sp_createstats @indexonly = 'NO', @fullscan = 'FULLSCAN', @norecompute ='NO'
All worked fine, until I had to drop a column in a table, then an error 5074 occured, indicating that statistics should be dropped before dropping the column.
Is there a way to get SQL Server to drop silently user created statistics when a column is dropped ?
I don’t think you can make SQL server do it silently, as this is a common problem for people using user statistics. There is a way to drop relevant statistics with a custom query – would it work for your needs?