Friday, February 24, 2012

DELETE Rouge Statistic from sys.sysindexes

Morning,

I have a stale statistic that I need to remove from the sysindexes table.

It is causing our DB upgrade tool to fail.

In the past, on SQL Server 2000, I could just go into the sysindexes table and delete it.

In SQL Server 2005 of course, no ad hoc catalog changes error prohibits me from doing this.

How can I delete this rouge stat?

Thanks ALL!

What about using DROP STATISTICS?

AMB

|||

Thanks for the info AMB.

SO ... if I have a statistic named '_WA_Sys_name_009508B4'

How do I find what table it is referencing in order to use that table name in the DROP STATISTICS command?

Thanks for your help so far!

J Kusch

|||

Try:

select

object_name([object_id])as table_name,

[name] as stats_name

from

sys.stats

where

[name] like'\_WA\_Sys\_%'escape'\'

AMB

|||

PERFECT!

Thanks a bunch for all the help!

No comments:

Post a Comment