Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.ms-sqlserver    |    Notorious Rube Goldberg contraption    |    19,505 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 18,065 of 19,505    |
|    Lennart Jonsson to tshad    |
|    Re: Case with NULL    |
|    13 Jan 11 09:15:02    |
      From: erik.lennart.jonsson@gmail.com              On 2011-01-13 04:12, tshad wrote:       [...]       >       > SELECT PersonID = CASE o.ID WHEN NULL THEN o2.ID ELSE o.ID END              I'm a bit surprised that this works. This case construction uses "=" and       nothing (including null) equals null. FWIW, this should be equal to:              SELECT coalesce(o.ID, o2.ID)              >       > But not:       >       > SELECT PersonID = CASE o.ID WHEN NOT NULL THEN o2.ID ELSE o.ID END       >       > I get an error:       >       > Incorrect syntax near the keyword 'NOT'.       >       > and       >       > SELECT PersonID = CASE o.ID WHEN IS NOT NULL THEN o2.ID ELSE o.ID END       >              There is another CASE construction (my windows vm is down so I can't       verify whether it is supported by sqlserver)              CASE WHEN o.ID IS NOT NULL THEN o2.ID ELSE ...                     /Lennart              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca