Re: NULL = NULL not working

From: we7313 (we7313_at_discussions.microsoft.com)
Date: 12/05/04

  • Next message: Larry Bird: "Installing English Query on XP Pro SP"
    Date: Sun, 5 Dec 2004 07:07:01 -0800
    
    

    "Hugo Kornelis" wrote:

    > On Sat, 4 Dec 2004 15:53:05 -0800, we7313 wrote:
    >
    > >I have a proc that can specify a price range if its passed in.
    > >my and where clause looks like this:
    > >
    > >where ((PriceViewHotelPrice.price + PriceViewAirPrice.price)between 500 and
    > >600) or(NULL = NULL))
    > >
    > >I have removed the parameters & replaced them with the values passed in
    > >running it through Sql Analyzer & have confirmed the problem.
    > >If I replace NULL = NULL with 'a' = 'a' it works fine. Does anyone see the
    > >problem with this?
    >
    > Hi we7313,
    >
    > This is working as designed. Using ANSI-standard behaviour for NULLs, NULL
    > is never equal to anything. Think of NULL as an unknown value. If you
    > asked you if an unknown value is equal to an unknown value, would you say
    > "yes", "no" or "no idea"?
    > Welcome in the wonderfull world of three-valued logic!
    >
    > This being said, I'm not sure what you're trying to accomplish and why you
    > are trying to do it this way. Could you explain your actual problem
    > instead of presenting only a partial solution? There might be other, maybe
    > even better ways to solve your problem.
    >
    > If you describe the problem, it would be helpfull to include table
    > structure (as CREATE TABLE statements, including all constraints), sample
    > data (as INSERT statements) and expected output - that often helps getting
    > across what you try to do AND it's a useful testing aid.
    >
    > Best, Hugo
    > --
    >
    > (Remove _NO_ and _SPAM_ to get my e-mail address)
    >

    Well now that you say that & sql books online confirms it, I see why it
    isn't working. The reason I do a statement like above is to apply optional
    criteria based on the parameter values passed in. Thanks for the help.


  • Next message: Larry Bird: "Installing English Query on XP Pro SP"

    Relevant Pages

    • NULL = NULL not working
      ... I have a proc that can specify a price range if its passed in. ... my and where clause looks like this: ...
      (microsoft.public.sqlserver.mseq)
    • Re: S-function Builder and Dynamic Arrays
      ... unknown size (ie a dynamic array) as input. ... column where you are supposed to specify the row size but if this is ... But I doubt the SFunction builder wizard supports this. ...
      (comp.soft-sys.matlab)
    • Re: Opening an already-connected unit with status=unknown
      ... I'd say that the standard comes close to ... contradicting itself here, but not quite. ... It doesn't say "OLD or UNKNOWN". ... you can specify OLD or you can omit the STATUS=, ...
      (comp.lang.fortran)
    • Re: Type of Data Returned by a Function
      ... returned by my functions is "unknown" in the following syntax: ... I *think* I can specify that by doing something like this: ... The only thing I can think of that might have something to do with what you say are phpdoc comments: ...
      (comp.lang.php)
    • Re: lambda... again
      ... regular proc. ... proc unknown args $what\n ... lambdas is going to be annoying: ... global print;# typing global all the time quickly gets annoying ...
      (comp.lang.tcl)