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

  • Home
  • SEARCH
  • 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 8833613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:49:19+00:00 2026-06-14T08:49:19+00:00

I am having difficulty establishing the correct syntax for calling a stored procedure within

  • 0

I am having difficulty establishing the correct syntax for calling a stored procedure within a stored procedure. I thought this syntax was correct:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[newProc](
    @param1 varchar(50),
    @param2 nvarchar(2000),
    @param3 int,
    @param4 int,
    @param5 int,
    @param6 int
)
AS
BEGIN
    SET NOCOUNT ON;

    EXEC [dbo].[externProc1] @param1, @param2;
    GO

    EXEC [dbo].[externProc2] @param3, @param4;
    GO

    EXEC [dbo].[insertProc3] @param5, @param6;
    GO

END
GO

But when I try this, I keep getting
“Incorrect syntax near ‘;’ Must declare the scalar variable @param3.
Must declare the scalar variable @param5.”

What is the correct syntax for calling a stored procedure with parameters from within another stored procedure?

  • 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-14T08:49:21+00:00Added an answer on June 14, 2026 at 8:49 am

    The GO keyword in T-SQL states that a block of t-sql statements ends and executes that block. This means that a variable defined in one block is not longer “in scope” for a statement occurring after that block has been ended/executed with GO.

    GO is not actually a transact sql statement:

    http://msdn.microsoft.com/en-us/library/ms188037(v=sql.105).aspx

    Users must follow the rules for batches. For example, any execution of
    a stored procedure after the first statement in a batch must include
    the EXECUTE keyword. The scope of local (user-defined) variables is
    limited to a batch, and cannot be referenced after a GO command.

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

Sidebar

Related Questions

I'm having difficulty with calling a public method from within my plugin itself. I'm
I'm having difficulty referencing this from within a javascript inline function, within an object
I'm having difficulty iterating through records while scrolling window. My initial thought was to
I'm having difficulty understanding variable shadowing in JavaScript based on scopes. Consider this small
I'm having difficulty extracting amplitude data from linear PCM on the iPhone stored in
I've been having difficulty with getting my users to set the PATH environment variable
I am having difficulty geting a very simple view to display. This view has
Having difficulty finding relevant search results... Given this model: public abstract class A {
I'm having difficulty with this problem. I have a table with this structure: OrderID
I'm having difficulty conceptualizing how to do this in the best way possible without

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.