home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!news.netmbx.de!Germany.EU.net!mcsun!sunic!seunet!enea!sommar
- From: sommar@enea.se (Erland Sommarskog)
- Newsgroups: comp.databases.sybase
- Subject: Fun with isnull
- Message-ID: <1993Jan5.173012.9858@enea.se>
- Date: 5 Jan 93 17:30:12 GMT
- Organization: Enea Data AB
- Lines: 29
-
- Consider this query:
-
- update nisse
- set s1 = (select sum(v1)
- from pelle p
- where p.k2 = nisse.k2)
-
- Which rows do you think it updates? Right, it updates the same rows
- as the select statement covers.
-
- Now, consider:
-
- update nisse
- set s1 = (select isnull(sum(v1), 4711)
- from pelle p
- where p.k2 = nisse.k2)
-
- Which rows do you think this query updates? The same? Wrong answer.
- All rows in nisse. Not a single one saved.
-
- Another interesting feature with isnull which is a colleague of mine
- have run into, but I haven't been able to reproduce is that it sometimes
- returns - NULL!
-
- These amusements happened with a 4.2 server on AIX 3.2, and with an
- SQL server on OS/2 of some version - probably a fairly old one.
- --
- Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
- Jag gav en k{ck tjeck en check.
-