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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:59:00+00:00 2026-06-14T01:59:00+00:00

Ran into this issue, and I don’t know why it won’t work. I have

  • 0

Ran into this issue, and I don’t know why it won’t work.

I have a stored procedure that has an optional 2nd parameter.

PROCEDURE [dbo].[gsp_MyProC] @Account_Number VARCHAR(10), @Referral_Type VARCHAR(5) ='1'

Now, @Referral_Type gets used in a SQL statement, and currently never gets passed into the procedure (legacy code, don’t ask). However, sometimes it doesn’t get set to one, its just left to null (verified by returning the parameter).

If I use:

SET @Referral_Type = 1

inside the stored procedure, It always gets set (as would be expected).

But does anyone know why the default value wouldn’t be getting set to 1?

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-06-14T01:59:01+00:00Added an answer on June 14, 2026 at 1:59 am

    There is a distinction between not providing a parameter, and providing a NULL value for a parameter…

    EXEC dbo.gsp_MyProC 'AccountNumber', NULL
    

    Will result in @Referral_Type = NULL

    However…

    EXEC dbo.gsp_MyProC 'AccountNumber'
    

    Will result in @Referral_Type = '1'

    It is likely that your client library is providing a NULL value instead of not providing any value at all.

    As a work-around… if @Referral_Type should never be NULL, you can add SET @Referral_Type = ISNULL(@Referral_Type, '1') at the beginning of your stored procedure.

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

Sidebar

Related Questions

I don't know if there is a work around for this IE9 issue I
I have ran into a really annoying issue which gives me this error: The
Just about everyone has ran into this specific issue: function addLinks () { for
I've ran into this issue before but don't remember what was causing it. I
I ran into this issue while testing a rails app deployed to two different
I just ran into this issue while making a GET request to a node.js
I've ran into trouble with SOAP, I've never had this issue before and can't
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
I ran into this situation today. I have an object which I'm testing for
I'm trying to create a website for myself and just ran into this issue:

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.