Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1848

Re: CASE issue

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: CASE issue
Date Mon, 24 Nov 2014 23:37:12 +0100
Organization Erland Sommarskog
Lines 17
Message-ID <XnsA3EFF04705958Yazorman@127.0.0.1> (permalink)
References <547306f8$0$41749$c3e8da3$5d8fb80f@news.astraweb.com> <XnsA3EF7E8B63B6CYazorman@127.0.0.1> <m4vlom$q0c$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Injection-Info mx02.eternal-september.org; posting-host="416ef8a880b1e4f6f96e9a7c39a8d7a9"; logging-data="26797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Z0zL3GbkZY+s2OnO0MiiM"
User-Agent Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32)
Cancel-Lock sha1:aT6agwGg32oOIkzuKohVwbp6M9E=
Xref csiph.com comp.databases.ms-sqlserver:1848

Show key headers only | View raw


Lennart Jonsson (erik.lennart.jonsson@gmail.com) writes:
> I think (don't have time to look it up now) the SQL-standard says that 
> the result of the CASE statement is the first condition that evaluates 
> to true. From your answer I get the impression that this is not true for 
> SQL-server, correct?

That is indeed true. The issue is that the expression on the left-hand side 
is reevaluated for every branch in the CASE. 

newid() is a function that returns a randomly generated GUID, so it is a bit 
of a special case.
 



-- 
Erland Sommarskog, Stockholm, esquel@sommarskog.se

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

CASE issue "twenty-six@b-mint.net" <twenty-six@b-mint.net> - 2014-11-24 10:22 +0000
  Re: CASE issue Erland Sommarskog <esquel@sommarskog.se> - 2014-11-24 11:26 +0000
    Re: CASE issue bradbury9 <ray.bradbury9@gmail.com> - 2014-11-24 04:16 -0800
      Re: CASE issue Erland Sommarskog <esquel@sommarskog.se> - 2014-11-24 14:28 +0000
        Re: CASE issue Erland Sommarskog <esquel@sommarskog.se> - 2014-11-28 22:47 +0100
          Re: CASE issue Jim <jgeissman@socal.rr.com> - 2014-11-28 17:19 -0800
    Re: CASE issue "twenty-six@b-mint.net" <twenty-six@b-mint.net> - 2014-11-24 13:32 +0000
      Re: CASE issue Erland Sommarskog <esquel@sommarskog.se> - 2014-11-24 14:25 +0000
        Re: CASE issue "twenty-six@b-mint.net" <twenty-six@b-mint.net> - 2014-11-24 16:06 +0000
    Re: CASE issue Lennart Jonsson <erik.lennart.jonsson@gmail.com> - 2014-11-24 17:18 +0100
      Re: CASE issue Erland Sommarskog <esquel@sommarskog.se> - 2014-11-24 23:37 +0100
        Re: CASE issue Lennart Jonsson <erik.lennart.jonsson@gmail.com> - 2014-11-25 06:25 +0100
          Re: CASE issue Jim <jgeissman@socal.rr.com> - 2014-11-28 16:07 -0800
            Re: CASE issue Erland Sommarskog <esquel@sommarskog.se> - 2014-11-29 10:43 +0100

csiph-web