results in a table

  • I am trying to get the results returned from sp_helpindex <tablename> into a table. Can anyone pl let me know how I can do this. any help will be greatly appreciated

    TIA 

  • create table #indexes (index_name sysname, index_description varchar(1000), index_keys varchar(1000))

    insert into #indexes exec sp_helpindex <tablename>

     

    If you want a permanent table just change the created table.



    Shamless self promotion - read my blog http://sirsql.net

  • Hi,

    I think you might have write a SP for that.

    I can suggest a very crude way and it can work provided there are not many tables.

    save the result of the sp_helpindex in a .rpt file using the "Results to file" option of Query Analyser.

    The edit the file as it will contain the column names of every sp_helpindex command issued. Leave the first line with column names as it is.

    You can then import this .rpt file to a table using DTS.

    Hope this crude method helps.

     

    Regards,

    Umesh Chaphekar



    Umesh Chaphekar

    --Every minute you waste someone gains on you ---

  • Good One Cain.

    Mine was so stupid..



    Umesh Chaphekar

    --Every minute you waste someone gains on you ---

  • Is there a way to do the same for SP_HELP. This works for SP_HELPINDEXES because it only return 1 result set so, we can create table structure accurately for the sp_helpindex result.

    Thanks,

  • For system procedures that return multiple result sets, I don't think it can be done.  However, you can script the procedure in Query Analyzer, and probably parse out the piece of the procedure that gives you the information you are looking for, and create a new procedure that produces a single result set.

    Steve

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply