Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for SQL to Gen INDEX DDL

Status
Not open for further replies.

btturner

Programmer
May 17, 2001
175
US
I am looking for some SQL to read the SQL Server Catalog and auto-gen DDL for Indexes? (joing sysindexes to sysobjects, etc)

I don't just need the index name - I need the entire set of DDL for a given index. To be used to reCREATE indexes after I drop them and load a db w/ data.

thanks for any help here.
 
I don't know how to do this using SQL, but... I've done this with VB and the SQLDMO object. If you're interested, I can help that way.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Yes, by all means. I'd really appreciate the SQL-DMO VB knowledge - to generate INDEX DDL.
 
Sorry it took so long. I wanted to clean up the utility a little.

This utility is provided as is. I will not be held responsible for any problems that arise from using this. I quarantee that the project I am making available to download does NOT modify any database in any way. It simply returns scripts. You are responsible for verifying the scripts.

This vb project is, in no way, production quality. We use it here as a utility ONLY. It will generate scripts and those scripts can be used for generating indexes (and other things) in a SQL Server 2000 database.

SQL Server creates indexes for all your primary keys. This utility does nothing with those indexes. In order to drop/add indexes that are part of a primary key, you must first drop the constraint, etc... Therefore, indexes that are part of a primary key are ignored by this utility.

I hope this helps.




-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top