home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / sybase / 760 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.5 KB  |  49 lines

  1. Newsgroups: comp.databases.sybase
  2. Path: sparky!uunet!math.fu-berlin.de!ira.uka.de!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!utcsri!newsflash.concordia.ca!mizar.cc.umanitoba.ca!mctrf
  3. From: mctrf@ccu.umanitoba.ca (Manitoba Cancer Treatment Mctrf Research)
  4. Subject: NULL value
  5. Message-ID: <C1J8FA.Fpv@ccu.umanitoba.ca>
  6. Sender: news@ccu.umanitoba.ca
  7. Nntp-Posting-Host: ccu.umanitoba.ca
  8. Organization: University of Manitoba, Winnipeg, Manitoba, Canada
  9. Distribution: na
  10. Date: Wed, 27 Jan 1993 21:45:09 GMT
  11. Lines: 36
  12.  
  13.     "When you compare a null value with another value the result is 
  14.      never true; a null value does not match anything, not even another
  15.      null value"
  16.                 --- Chapter 2, Transact-SQL User's Guide
  17.  
  18. Fine.  But I didn't really expect the following.
  19.  
  20.     1> if convert(int, NULL) = convert(int, NULL)
  21.     2>      print '*** YES ***'
  22.     3> else
  23.     4>      print '*** NO  ***'
  24.     5> go
  25.     *** NO  ***
  26.     1> if NOT (convert(int, NULL) = convert(int, NULL))
  27.     2>      print '*** YES ***'
  28.     3> else
  29.     4>      print '*** NO  ***'
  30.     5> go
  31.     *** NO  ***
  32.  
  33. To solve the "contradiction" between the two IF's, I have to really
  34. understand next quotation.
  35.  
  36.     "Computations involving NULL evaluate to NULL, because the result
  37.     must be unknown if any of the factors is unknown."
  38.                  --- Chapter 2, Transact-SQL User's Guide
  39.  
  40.  
  41. So, conceptually at least, a Boolean expression evaluates to TRUE, FALSE
  42. or NULL, and neither NULL nor (NOT NULL) is TRUE! 
  43.  
  44. I'm using Sybase SQL server 4.0.1.
  45.  
  46. Vincent Yin
  47. mctrf@ccu.umanitoba.ca
  48.  
  49.