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 6564085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:55:23+00:00 2026-05-25T13:55:23+00:00

ALTER PROC SP_SampleInner AS SELECT COUNT(*) FROM TB_Whatever Other procedure ALTER RPROC SP_SampleOuter AS

  • 0
ALTER PROC SP_SampleInner
AS
SELECT COUNT(*) FROM TB_Whatever

Other procedure

ALTER RPROC SP_SampleOuter
AS
DECLARE @count int
EXEC @count = SP_SampleInner

IF @count > 0
BEGIN
SELECT 1
END
ELSE
BEGIN
SELECT 0
END

What I want is SP_SampleOuter returns more than one table because of EXEC SP_SampleInner (I think). How could I control returning tables/values?

  • 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-05-25T13:55:24+00:00Added an answer on May 25, 2026 at 1:55 pm

    Try this approach:

    ALTER PROC SP_SampleOuter
    AS
    DECLARE @count int
    EXEC @count = SP_SampleInner
    
    IF @count > 0
    BEGIN
    SELECT @count as Ctr,1
    END
    ELSE
    BEGIN
    SELECT @count as Ctr,0
    END
    

    Simply add the count variable as the first field you return

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ALTER PROC [Admin].[sp_Ques] ( @QuesID bigint ) DECLARE @Lang int AS BEGIN . .
ALTER PROCEDURE [Lending].[uspHMDALarIncomeGet] (@ApplicationId int) AS BEGIN SET NOCOUNT ON SET TRANSACTION ISOLATION LEVEL
The stored procedure: ALTER PROC [Admin].[sp_Ques] ( @QuesID bigint ) AS BEGIN IF @QuesID
I need to pass set of int to sql procedure. alter PROC PrCustomerServicesUpd( @CustomerId
If I have this stored proc definition minus the body ALTER PROCEDURE sp_AlloctionReport(@where NVARCHAR(1000),
Consider this trigger: ALTER TRIGGER myTrigger ON someTable AFTER INSERT AS BEGIN DELETE FROM
Hi i have the following stored proc in SQL Server 2005: ALTER PROCEDURE [dbo].[slot_sp_EngineerTimeslots_Group]
ALTER PROC [Schema1].[SetDefaultBAdd] ( @UserAddDetailID bigint, @IsB bit ) AS BEGIN UPDATE Schema1.UserAddDetails SET
my query is: ALTER PROC [dbo].[AddUpdate] ---212,'pp','en-US' @MID int, @LPName nvarchar(250), @CCode nvarchar(50) AS
ALTER PROCEDURE [dbo].[GetDocumentsAdvancedSearch] @SDI CHAR(10) = NULL ,@Client CHAR(4) = NULL ,@AccountNumber VARCHAR(20) =

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.