• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 975
  • Last Modified:


I need to execute SP_HelpLogins and insert the data into 2 tables (since it returns two result sets)..  

Any suggestions?
2 Solutions
Scott PletcherSenior DBACommented:
You are going to have to use VB or some other true programming environment.  Native T-SQL does not directly handle two different result sets from one sp.

Or you could create a copy of the sp_helpLogins proc that left the temp tables containing the info there instead of deleting them, then use those temp tables yourself :-) .
You could do a sp_helptext on the sp_helplogins,
copy the code and create a new procedure (if possible, if permissions allow you to)

Within the new procedure just alter it to add something like this to the code (before line 460 of the stored procedure)

select * into MyPlainLogins from #tb2_PlainLogins
select * into MyUA from #tb1_UA

Then use MyPlainLogins and MyUA tables as you please.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now