Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
okalosha
Starting Member
4 Posts |
Posted - 2005-10-28 : 13:06:44
|
| Hi -I could not find an SQL script, which would generate index creation DDL for a specific table/index. Query Analyzer does it, but I need to do it programmatically. I am writing upgrader tool, which can alter or drop columns. Before altering columns, for example, I need to drop all indexes for that column, and then re-create them. So I need to programmatically generate and memorize full index definition before dropping it.I do not want to reinvent the wheel and write the script querying sysindex and related system tables. Does anyone have a working script?Thank you. |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-10-28 : 14:30:58
|
quote: Originally posted by okalosha but I need to do it programmatically. I am writing upgrader tool, which can alter or drop columns. Before altering columns, for example, I need to drop all indexes for that column, and then re-create them. So I need to programmatically generate and memorize full index definition before dropping it.
[shudder]What are you writing, an administrator tools, or some clinet application. This really shouldn't be done on the fly.[/shudder]Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-10-28 : 14:31:55
|
| http://mindsdoor.net/DMO/DMOScripting.html maybe?Kristen |
 |
|
|
okalosha
Starting Member
4 Posts |
Posted - 2005-10-28 : 19:22:32
|
This is a client application for database upgrade. It should sniff out index definitions, drop indexes for particular tables, modify tables and re-create indexes. quote: http://mindsdoor.net/DMO/DMOScripting.html maybe?
Unfortunatelly, it is for tables/procs/functions only. |
 |
|
|
Kristen
Test
22859 Posts |
|
|
|
|
|
|
|