Okay, I have a program that does mass importation of data once a month. By "mass importation", I mean 10-15 million records, easily. I have several indexes on that table, but keeping the indexes there during import slows it down to a quarter of what it takes without the indexes.

Currently I have code in the program to drop the indexes, perform the import, and re-create the indexes... which indexes are dropped/created are hard-coded.

The problem is that we've added several new indexes to the tables and will likely add more in coming months. I CAN just go in and add the new indexes to the list of things to be dropped and created, but I hate having to do that every time we add or delete an index.

So. Is there a way from inside my program to find out what indexes exist on my target tables (there are 3) and generate create/drop scripts that I can run at the proper time against the database? That way the whole process is automated.

I am running Visual Studio 2008 and Sql-Server 2008.

Thanks in advance.