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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:19:52+00:00 2026-06-08T21:19:52+00:00

I have 4 records in my SQL table that and I’m doing a SQL

  • 0

I have 4 records in my SQL table that and I’m doing a SQL select statement to select records based on a certain criteria but I’m not picking any records up. Can someone please help?

Here is my SELECT statement:

string Sql = "";  
Sql = @"SELECT * FROM " + _dtlName + " 
        WHERE Shipper_No = '" + sidNo + "' 
        AND Job_Code != '" + "R" + "'";  

I have 3 records that have a Null for Job_Code and 1 record that has an R.

Based on that, I should pickup the 3 records with the NULL Job_Code but it returns 0 records.

  • 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-08T21:19:54+00:00Added an answer on June 8, 2026 at 9:19 pm

    I suspect the problem is that a comparison between any non-null value and a null value doesn’t return a value of true or false, but null. So your query should probably be:

    string sql = "SELECT * FROM " + _dtlName + " WHERE Shipper_No = @ShipperNo " +
                 "AND (Job_Code IS NULL OR Job_Code != 'R')";
    

    (Note that I’ve extracted a parameter for Shipper_No – you shouldn’t be including values directly in your SQL like that. Obviously you’ll need to then set the parameter value in the SQL command.)

    Also note that <> is more common in SQL to represent “not equal to”, but I believe T-SQL allows either form.

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

Sidebar

Related Questions

I have a script that processes queued records in a SQL table in SQL
I have a sql query that is retrieving results from a table but I
I have bulk records that are getting imported into a SQL Server 2005 table.
i have a sql server table with records (that isn't new) it has 1
I need to display records from my sql from the parent table that have
I have an ADOQuery that inserts a record to SQL Server 2005 table that
I have a SharePoint external list that points to a 100,000 record SQL table.
I have a SQL Server database with 500,000 records in table main . There
I have an SQL query that returns all companies records ignore the ones with
Using SQL Server 2005 I have a query that gets child records from bundles

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.