Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generate Index script
Message
De
02/01/2012 08:04:11
 
 
À
02/01/2012 05:05:14
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01531981
Message ID:
01532024
Vues:
26
Dragan

Good ideas in TOAD (what a name!)
The script Naomi pointed me to is 95% there
It gives me the create commands for all existing indexes.
I looked at the code that generates the script and it would be a fairly simple thing to to add the
IF EXISTS

I want to drop an existing index if it exists (ala DELETE TAG)
I have scripted a few apps manually, but I'm always afraid of missing an index.

Here's a snippet from the script I coded manually
IF EXISTS (SELECT name FROM sys.indexes
            WHERE name = N'IX_invtrans_parenttransid')
    DROP INDEX IX_invtrans_parenttransid ON safesignature.dbo.invtrans
GO

CREATE INDEX IX_invtrans_parenttransid 
    ON safesignature.dbo.invtrans (parenttransid); 
GO
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform