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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 using rows returned from sp_helpindex

Author  Topic 

sgtwilko
Starting Member

23 Posts

Posted - 2001-11-13 : 06:20:24
I have tried and failed to use the returned rows the sp_helpindex procedure.

These are the ways I've found that don't work...
Select * from sp_helpindex 't_UnitPMVDetails'

Select * from sp_helpindex('t_UnitPMVDetails')

Select * from exec('sp_helpindex "t_UnitPMVDetails"')

declare @rs table(indexnamve nvarchar(255), index_description nvarchar(4000), index_keys nvarchar(4000))
set @rs = execute('sp_helpindex "t_UnitPMVDetails"')

so any ideas?

--
Eagles may soar,
but Weasels aren't sucked into jet engines.

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-01-04 : 10:35:44
am posting my problem here....as I thinks it's a variation of the original question, but I don't understand (see) how I can apply the solution to my situation....


2 lines below executed from Qa....usinq SQL 7.0...
line 1 works, line 2 doesn't...
can line 2 be adjusted to work? do I need to output the SP recordset to a temp table (as suggested in the original solution)?


select * from (select * from time_period where id = 9) as a
select * from (exec usp_get_one_time_period @intimeperiodid=9) as b

Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-01-04 : 17:07:24
Andrew,

What else are you doing with the results from your usp other than just displaying them? If you're just displaying them, then why not get rid of the SELECT * FROM... and just go with the EXEC... part?

You can insert the results of your usp into a temp table like the earlier post if you need them for another step.

OR, another option, if you're only returning a couple of values instead of a recordset is to return them in OUTPUT parameters.
--------------------------------------------------------------
1000 Posts, Here I come! I wonder what my new title will be...

Edited by - AjarnMark on 01/04/2002 17:08:36
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-01-07 : 05:31:54
Basically...I have a core routine which produces a result set, to which I want to join some other tables....and then display the merged set....

sometimes i'll want to join tables a+b to the core result....sometimes tables a+c, sometimes b+c+d....etc...but to avoid repeating the core query....i thought it might be better if i could put it into a SP....


looking back...my example was a bit simplistic....but I was rushed for time when posting it....

Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-01-07 : 17:34:54
Another option, which you've probably already considered, is to create a View. If that doesn't work, it sounds like the temp table is going to be the way to go.

--------------------------------------------------------------
1000 Posts, Here I come! I wonder what my new title will be...
Go to Top of Page
   

- Advertisement -