无法删除统计信息“Table_Name”,因为它不存在或您没有权限

时间:2015-06-26 07:11:56

标签: sql-server

在删除表并重新创建时,我们遇到以下错误:

“无法删除统计信息'dbo.SChema.STATS_table_name',因为它 不存在或您没有权限。

2 个答案:

答案 0 :(得分:1)

Following are the points you should consider:

  1. Check the permissions for the user
  2. Check if the stats are not being dropped because of any indexes
  3. If you have a pre-written script, check if they are dropped before the script actually runs (may be due to some other scripts, happened with me once :p)

答案 1 :(得分:0)

如果您手动删除了表,现在尝试添加迁移,尝试通过代码删除该表(例如,您刚刚删除了实体类),您也会收到此错误。然后你只需要创建该表' Table_Name'手动直接在数据库中。然后再次添加迁移。