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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:24:00+00:00 2026-05-27T05:24:00+00:00

I have a very large application and it would create headache to change every

  • 0

I have a very large application and it would create headache to change every call to this procedure, so I am attempting to make an optional parameter to the procedure. Here are the top two lines of the procedure

ALTER PROCEDURE [dbo].[sp_get_entity_list]
@entityid int , @entitycat int, @adminTab bit = 0, @root int = 0

When calling the procedure in code, usually it is called

"EXEC sp_get_entity_list " & EntityID & ", " & EntityCAT 

but in a few cases I need to pass a bit type parameter to show it came from a different location – i am calling this by using

"EXEC sp_get_entity_list " & EntityID & ", " & EntityCAT & ",1"

Am I doing something wrong? I am unsure if this is the correct way to pass an optional parameter, I want adminTab to be set to false (or null, does not matter), unless I pass the optional parameter. Thanks.

  • 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-27T05:24:01+00:00Added an answer on May 27, 2026 at 5:24 am

    I think its better to include the name of each parameter when executing a stored procedure like:

    EXEC sp_get_entity_list @entityid=" + EntityID + ", @entitycat=" + EntityCAT
    

    This means SQL knows exactly which parameters you are referring to.

    Therefore, if you have optional parameters, you don’t need to include every single one, if you wish to use the default value:

    EXEC sp_get_entity_list @EntityID=" & EntityID & ", @root=1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large web application. One very small piece of this web application
Here at work we have a very large application with multiple sub applications. (500
I have a very large set of permissions in my application that I represent
I have a large Compact Frameworks V2.0 application that in most cases works very
I have a very large file that looks like this (see below). I have
At work we currently have a very large web application with a connection to
I have an idea for a large web application, which in my mind would
We have a very large JavaScript application, where after many months of coding there
Our application has a very large, wide table of transactional data. We have a
I have a simple WPF application where I display one very large image (9000x2875)

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.