Actual text value of Null

  • Quick one for you all. I dont have access to test this or I would but I know you all are quick to help a brother out.

    I have an instance where a process is trying to insert a Customer into the Customers table and CustomerLastName is a non nullable field. Customer's last name is Null. Should this be the reason this Customer is never in the end table?

    Thanks in advance,

    Steve

  • samartel (6/24/2015)


    Quick one for you all. I dont have access to test this or I would but I know you all are quick to help a brother out.

    I have an instance where a process is trying to insert a Customer into the Customers table and CustomerLastName is a non nullable field. Customer's last name is Null. Should this be the reason this Customer is never in the end table?

    Thanks in advance,

    Steve

    SQL Server distinguishes between NULL and "Null", so no, this isn't the reason.

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Cheers.

    Appreciate the time

    Steve

  • ChrisM@Work (6/24/2015)


    samartel (6/24/2015)


    Quick one for you all. I dont have access to test this or I would but I know you all are quick to help a brother out.

    I have an instance where a process is trying to insert a Customer into the Customers table and CustomerLastName is a non nullable field. Customer's last name is Null. Should this be the reason this Customer is never in the end table?

    Thanks in advance,

    Steve

    SQL Server distinguishes between NULL and "Null", so no, this isn't the reason.

    That might depend on how the INSERT was done. I can imagine a scenario where the SQL is dynamically constructed and the value was inappropriately checked for either a genuine NULL value or a text value of Null with a case-insensitive comparison, and the net result is that the customer's actual inserted record might have an empty string because the developer at the time didn't quite know what to do with such because it is a required field, and just decided to assign an empty string. I'd like to think that this is unlikely, but given some of the things I've seen over the years, it wouldn't surprise me. Do a SELECT from that table WHERE the last name field is checked for equality with 'Null' and be sure to include the single quotes. If that doesn't bring back that record, then try and find out enough other details to identify that record and see what the last name field's value is.

    Steve (aka sgmunson) πŸ™‚ πŸ™‚ πŸ™‚
    Rent Servers for Income (picks and shovels strategy)

  • Interesting.

    I will need to deep dive into this to get a better perspective.

    Thanks again,

    Steve

  • samartel (6/24/2015)


    Interesting.

    I will need to deep dive into this to get a better perspective.

    Thanks again,

    Steve

    If you can find out approximately when the data record was added, you might be able to look at what should be a small subset of the table based on an "updated date" field, assuming such a field exists.

    Steve (aka sgmunson) πŸ™‚ πŸ™‚ πŸ™‚
    Rent Servers for Income (picks and shovels strategy)

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply