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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:21:34+00:00 2026-06-13T22:21:34+00:00

I was reviewing a stored procedure where I found piece of code below. Looking

  • 0

I was reviewing a stored procedure where I found piece of code below. Looking at the code, my perception is that we are creating a variable named @QuestionInclude and passing its value in dynamic sql statement. But how this code is working?

This is something strage and new to me.

declare @QuestionInclude varchar(10)
select @sqln =  'select @QuestionInclude = 1 from ##Stg_Prelim' 
exec sp_executesql @sqln,N'@QuestionInclude varchar(10) output',@QuestionInclude output
  • 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-13T22:21:36+00:00Added an answer on June 13, 2026 at 10:21 pm

    may be this will help you

    http://msdn.microsoft.com/en-us/library/ms188001.aspx

    procedure sp_executesql have parameters @stmt, which is actual statement to run, @params – declaration of parameters, and then all parameters declared in @params

    It’s also better to pass parameters by names

    declare @QuestionInclude varchar(10), @stmt nvarchar(max), @params nvarchar(max)
    
    select @stmt = 'select @QuestionInclude = 1 from ##Stg_Prelim'
    select @params = '@QuestionInclude varchar(10) output'
    
    exec sp_executesql
        @stmt = @stmt,
        @params = @params,
        @QuestionInclude = @QuestionInclude output
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQLServer2008 R2 Stored Procedure that contains an algorithm for parsing out
I'm reviewing a piece of code and see a class where an std::vector is
We're reviewing the code of Classic ASP application. In the code that we're reviewing
An auditor reviewing our system was suggesting that our data should be stored on
Reviewing a changes of old piece of code, I saw a pretty interesting change.
Upon reviewing a bunch of MVC style web applications, I'm noticing that it's common
When reviewing on different OS's, I noticed that particularly in Chrome and Safari, words
I'm reviewing some code on the project I recently joined, and in a C#
I'm reviewing some code from one of our contractors: if (userLists != null) {
I need to understand this piece better because when I reached that step in

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.