Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generate Index script
Message
From
02/01/2012 08:04:11
 
 
To
02/01/2012 05:05:14
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Microsoft SQL Server
Category:
Scripting
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01531981
Message ID:
01532024
Views:
25
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform