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)
 Access the 2º select of sp_login in t-sql

Author  Topic 

ricardohzsz
Starting Member

2 Posts

Posted - 2005-09-03 : 09:04:02
I want to process the second select returned by sp_login in t-sql

With others sp's, i can write:

inserto into #temptable
exec sp_helpsrvrolemember

But i don't know how to do it with sp_logins

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-09-03 : 09:56:09
I don't think you can "insert into exec <SP>" from an SP with multiple result sets.

As an alternative:
you could script sp_helplogins to a new window as create, change the name of the SP and comment out the selecting of the first result set. Then insert into #temptable exec <newSP>.

I guess the disadvantage of this would be if future releases sql server don't provide access to the same system tables as the current version of sp_helplogins. If that's the case you would need to re-do your new SP when (and if) sp_helplogins changes.

Be One with the Optimizer
TG
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-03 : 17:48:41
"Borrow" the source code that generates the second recordset?

master.dbo.sp_helptext 'sp_helplogins'

Kristen
Go to Top of Page

ricardohzsz
Starting Member

2 Posts

Posted - 2005-09-05 : 06:15:57
I know this way. I've used it.

But this sp is (by large) mor complex than others and I don't want to copy and paste code that i don't understand. This is the reason of my question.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-09-05 : 08:58:38
>>I don't want to copy and paste code that i don't understand

Good For You!! Too many people employ code they don't understand and then can't maintain it. System stored procedures can be a good rescource for both learning some t-sql tricks as well as learning about the system tables. I would encourage you to take some time (when you get a breather) to try and understand the code. Keep in mind that many of the system SPs were written a long time ago for previous versions and probably by a variety of people so it's not always the most efficient code but certainly contains some gems as far as techiniques and solutions.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -