Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking to see if a Statistic Exists
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01326484
Message ID:
01326487
Vues:
18
>>I need a little help. I am trying to drop some statistics in SQL Server 2000 but I do not know how to check to see if it exists first to keep it from bombing. I tried sysobjects and sysindexes to no avail. I know that in SQL Server 2005 I can reference sys.stats, but this does not work in 2000. Any and all help will be greatly appreciated. Below is a sample of my SQL 2005 Code so you can see what I am trying to accomplish in SQL 2000.
>>
>>IF EXISTS(
>> SELECT * FROM sys.stats
>> WHERE object_id = object_id('OrderFL')
>> AND name = '_dta_stat_514100872_4_7')
>> DROP STATISTICS OrderFL._dta_stat_514100872_4_7
>>
>>GO
>
>Check sp_HelpStats in BOL.
>
>See also Re: Getting it all from Statistics Thread #1302337 Message #1302628 (and the whole thread).



I did check that procedure before posting, it loops through the indexes on a given table and checks to see if those indexes has any statistics on them and then pulls the statistic names off of the indexes. I was looking for a more direct route.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform