We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now



DJMoonLight asked
Medium Priority
Last Modified: 2012-05-05
I need to execute SP_HelpLogins and insert the data into 2 tables (since it returns two result sets)..  

Any suggestions?
Watch Question

Senior DBA
Most Valuable Expert 2018
Distinguished Expert 2019
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 :-) .

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.