dcsimg
Results 1 to 12 of 12

Thread: CHR(0) - not the same as NULL

  1. #1

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,220

    CHR(0) - not the same as NULL

    Does anyone have any documentation on CHR(0). I found this on geekinterview, but other than that, I have nothing.

    I have looked in Oracle documentation, but I couldn't find it.

    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,793

    Re: CHR(0) - not the same as NULL

    Essentially NULL means UNKNOWN .... and yes CHR(0) is not the same. CHR(0) is the Null Character... which isn't NULL... huh? Wha? And I see that I'm essentially repeating what is in that link. What is it that you are looking for?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,220

    Re: CHR(0) - not the same as NULL

    Quote Originally Posted by techgnome View Post
    Essentially NULL means UNKNOWN .... and yes CHR(0) is not the same. CHR(0) is the Null Character... which isn't NULL... huh? Wha? And I see that I'm essentially repeating what is in that link. What is it that you are looking for?

    -tg
    Some documentation to convince my boss.

    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,266

    Re: CHR(0) - not the same as NULL

    In the beginning there was ASCII
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,955

    Re: CHR(0) - not the same as NULL

    Actually the ASCII character is usually written as NUL and not Null. Of course then again you have vbNullChar as the instrinsic constant for it, so go figure. But then you have vbNullString too, which is not the same as "" though it gets abused as such a lot.

    I'm not sure why anyone would confuse it with the concept of Null, the Variant subtype though. This what a database Null is returned as.

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,793

    Re: CHR(0) - not the same as NULL

    That's why I see a difference between Null (Chr(0)) and NULL (unknown... usually associated with database NULL "value") .... it doesn't help that .NET returns NULL Reference errors on uninstanciated objects (although, if you look at NULL as being unknown, there's an arguement that the error is infact correct, it's a pointer to an unknown location... *shrug*)

    I'm not sure one is going to find such documentation. At best, you'll find discussions like this one where the difference is contemplated... but nothing concrete... but then again...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: CHR(0) - not the same as NULL

    Both are different anyways, and there should be no confusion.

    NULL = empty space whose value is not known. It may have some junk value but that too is not guaranteed.
    CHR(0) = the character with ASCII code 0 which is called null character.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." Charles F. Kettering

    Read articles on My Blog 101 LINQ Samples JSON Validator XML Schema Validator "How Do I" videos on MSDN VB.NET and C# Comparison Good Coding Practices VBForums Reputation Saver String Enum Super Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  8. #8

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,220

    Re: CHR(0) - not the same as NULL

    Quote Originally Posted by Pradeep1210 View Post
    Both are different anyways, and there should be no confusion.

    NULL = empty space whose value is not known. It may have some junk value but that too is not guaranteed.
    CHR(0) = the character with ASCII code 0 which is called null character.
    NVL function can check for a null, but cannot check for a CHR(0).

    I agree both are different, but I need some document. Maybe I should try sending my boss to this forum.

    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  9. #9
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,266

    Re: CHR(0) - not the same as NULL

    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  10. #10
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: CHR(0) - not the same as NULL

    Better show him practically rather than pointing him to some article etc.

    Create a table with just one field which allows NULLs.
    Then add two records.. one that has NULL and other that has Chr(0).
    Run various queries and show him that both are different.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." Charles F. Kettering

    Read articles on My Blog 101 LINQ Samples JSON Validator XML Schema Validator "How Do I" videos on MSDN VB.NET and C# Comparison Good Coding Practices VBForums Reputation Saver String Enum Super Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  11. #11
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,266

    Re: CHR(0) - not the same as NULL

    I am from Missouri, so I like that suggestion.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,955

    Re: CHR(0) - not the same as NULL

    For a text field in a database a SQL NULL means "no value was supplied." If there is a NUL character then the field has one character with all bits zero.

    What's so tough?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width