Can't delete auto created statistics on SQL Server 2019

  • Hi,

    I'm have sysadmin rights but it is not possible for me to delete auto created statisitcs. I receive the message, that the statistic doesn't exits or I do not have enough rights to do this.

     

    drop statistics [company$Sales Line].[_WA_Sys_00000001_73A22229];

    What can I do to delete the auto created statistics.

  • Can you run: DBCC SHOW_STATISTICS([company$Sales Line],[_WA_Sys_00000001_73A22229])

    If this is a statistic on an index, then it cannot be dropped as it exists as long as the index exists.  For your database, do you have the [Auto Update Create Statistics] or [Auto Update Statistics] set to True?

  • kaluza wrote:

    Hi,

    I'm have sysadmin rights but it is not possible for me to delete auto created statisitcs. I receive the message, that the statistic doesn't exits or I do not have enough rights to do this.

    drop statistics [company$Sales Line].[_WA_Sys_00000001_73A22229];

    What can I do to delete the auto created statistics.

    is the [company$Sales Line] table name in the "dbo" schema?  If not, you must specify the schema name along with the table name... which is a good habit to get into for all table and other object names.  And, just to ask the question... the table name has a "$" sign in it?  Or is that from something else and should be a "period" where the schema name is "company" and the table name is "Sales Line" and it actually does have a space in it.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi,

    my problem was, that I have been connected to the wrong datebase with mit script.

    Thank you very much for your help.

  • kaluza wrote:

    Hi,

    my problem was, that I have been connected to the wrong datebase with mit script.

    Thank you very much for your help.

    Thanks for the feedback and pretty darned honest of you, as well.  I think we've all had a similar problem at least once.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply