Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8108261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:03:25+00:00 2026-06-06T01:03:25+00:00

This may be a dumb question, I have tried googling but I am probably

  • 0

This may be a dumb question, I have tried googling but I am probably not phrasing this properly so I will try to explain the problem here:

I am using SQL Server 2000 and I have a stored procedure (SP1) that iterates through a table with 3 records and executes another stored procedure (SP2) at each iteration.

SP2 does an insert and then does a select on the inserted record.

SP1 continues after the iterating, it does one select then ends.

When I execute SP1 I only want the resultset from that last select returned. But with this iteration I am getting 4 resultsets (1 for each of the iterations and then the SP1 select at the end) all returned.

Is there some way to say don't return the resultset of SP2 when I am iterating them as part of SP1?

I could create another stored procedure that is exactly the same as SP2 but which does not have a select at the end, that would probably handle it. But I would prefer to add something to SP1 which prevents the resultset from returning. Is that possible?

Here’s what the iteration in SP1 looks like right now:

set nocount on
declare c cursor for select room_id from st_room_ref where active = 1
declare @room_id int,
        @max_c int

open c

while 1 = 1
begin
    fetch c into @room_id
    if @@fetch_status <> 0 break

    select  @max_c = max(call_id) 
    from    st_call 
    where   room_id = @room_id 

    if      @max_c is null
    exec    st_getCall @room_id
end

close c
deallocate c

Please no dissertations on the wrongness of cursors. Just was hoping for some way to tell the st_getCall SP not to send it’s result set back.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:03:28+00:00Added an answer on June 6, 2026 at 1:03 am

    Have you tried the following?

    INSERT INTO
      @itteration_results
    EXEC
      st_getCall @room_id
    

    There is a restriction with this; you can’t nest it any deeper; st_getCall can’t have the same inside it.

    If you do end up needing that, you may get more milage from the accepted answer to this question:

    • how-to-select-into-temp-table-from-stored-procedure
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may seem like a dumb question but I have IDLE and I'm trying
This may be a dumb question, but I really have no idea and I'm
Ok so this may be a dumb question (probably some syntax) but Google didn't
This may seem like a dumb question, or even subjective, but I'm not sure
I fear this may be a dumb question/easy fix, but have been stuck for
Okay, this may be a dumb question, but I've not been able to find
I know this may be a dumb question, but my background is more in
This may be a really dumb question but I'm just starting to learn the
This may be a stupid question but I have a code with the following
This may be a very dumb question but I can't seem to get it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.