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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:39:35+00:00 2026-06-16T08:39:35+00:00

I have this stored procedure ALTER PROCEDURE [dbo].[usp_mySP] — Add the parameters for the

  • 0

I have this stored procedure

ALTER PROCEDURE [dbo].[usp_mySP]
    -- Add the parameters for the stored procedure here
    -- For inventory table check.
    @DealerID       VARCHAR(50),
    @Certified      VARCHAR(50) = NULL,
    -- For fuel value.
    @CityFeatureValue   VARCHAR(50),
    @HwyFeatureValue    VARCHAR(50)

AS
BEGIN
        BEGIN
        SELECT  InventoryID, 
                VIN
        FROM    Inventory
        WHERE   DealerID = @DealerID
                AND Deleted     =   'False'
                AND (IsPending  =   '0'         OR IsPending    IS NULL) 
                --AND (Certified    =   @Certified  OR @Certified   IS NULL)

                AND VIN IN
                        (
                            SELECT      VIN 
                            FROM        FuelPerformance
                            WHERE       (
                                            FeatureTitle = 'Fuel Economy (City)' 
                                            AND FeatureValue = @CityFeatureValue
                                        )
                                        OR 
                                        (
                                            FeatureTitle = 'Fuel Economy (Hwy)' 
                                            AND FeatureValue = @HwyFeatureValue
                                        )
                            GROUP BY    VIN
                            HAVING      COUNT(VIN) > 1
                        )
    END
END

I am calling it like :

EXEC usp_ListOfVehiclesOnFuelCondition_ForSingleDealer
   '09f5245d' , '', '18', '28'

When I am commenting the line

 AND (Certified = @Certified OR @Certified IS NULL)

it is giving the result, but when this line is there the result is blank.

Any suggestion where I am doing wrong?

  • 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-16T08:39:37+00:00Added an answer on June 16, 2026 at 8:39 am

    You are passing in an empty string (''). That is very different from NULL.

    Pass in the parameters as named parameters (without @Certified), or test for an empty string, or pass in a NULL.

    Named parameters:

    EXEC usp_ListOfVehiclesOnFuelCondition_ForSingleDealer @DealerId = '09f5245d',
                                                           @CityFeatureValue = '18', 
                                                           @HwyFeatureValue = '28'
    

    Passing a NULL:

    EXEC usp_ListOfVehiclesOnFuelCondition_ForSingleDealer '09f5245d', 
                                                           NULL, 
                                                           '18', 
                                                           '28'
    

    Checking for '':

    AND (Certified = @Certified OR @Certified IS NULL OR @Certified = '')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following stored procedure ALTER PROCEDURE [dbo].Test AS BEGIN CREATE TABLE ##table
I have a dynamic query which reads like this Alter PROCEDURE dbo.mySP -- Add
I have created a simple stored procedure like this: Alter Proc dbo.s5 ( @id
Ok, I have this code for the stored procedure right now. ALTER PROC [dbo].[Readxml]
So I have this MS SQL Stored Procedure: ALTER PROCEDURE [dbo].[Import_Agent_Client_Bucket_2010] AS BEGIN --
I have this stored procedure in my database: ALTER PROCEDURE [dbo].[sp_FTSearchLocation] @SearchFor nvarchar(200) =
I have this stored Proc: ALTER Procedure [dbo].[GetWebinars] ( @GroupingCode varchar(max) = 'AVM', @ItemNumber
If I have this stored proc definition minus the body ALTER PROCEDURE sp_AlloctionReport(@where NVARCHAR(1000),
I have a stored procedure that updates a table using linq, eg: (this is
I have stored procedure: ALTER PROCEDURE [dbo].[k_ShoppingCart_DELETE] @cartGUID nvarchar AS DELETE FROM [dbo].[k_ShoppingCart] WHERE

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.