I want to create index for specific table from Unix shell script, so that I need index name, index keys, and index description for that particular table.
"sp_helpindexes" gives all these details with some unwanted lines, but I need alternative way to get only index name, key and description.
Anyone please help me on this ....?
Custom made SQL request
You can find description of the sp_helpindex using sp_helptext command like this :
This will give you the definition of your stored prcedure. Then you can extract your required SQL request (which could be tricky, another store_proc).
Shell script to process output of sp_helpindex
On other side, it seems it is just a shell problem, once you can call your SQL server. For example, using the sqsh program (an isql like program), you can have a file myindexes.sql containing :
Then the command
will give you the sp_helpindex output that you can process. Using the sqsh output, the line 3 contain index name and keys, the line 4 the description. I use :
Hope this helps a little.