Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

Assigning categories to values 2 Expand / Collapse
Author
Message
Posted Wednesday, May 15, 2013 3:29 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:06 AM
Points: 1,779, Visits: 6,465
You should only rely on clauses evaluating in order when no aggregates are involved.


Good job the question didn't include any of those or I'd have been scuppered!
Post #1452991
Posted Wednesday, May 15, 2013 3:51 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, October 10, 2014 7:07 AM
Points: 3,545, Visits: 2,654
Because of yesterday's question, i was little afraid to check the answer but after wasting few minutes, found nothing fishy and locked my answer and bongo !!!

Good second part this.
Post #1453000
Posted Wednesday, May 15, 2013 3:54 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 900, Visits: 1,267
Thanks for the questions. Got it wrong yesterday and right today so I must be learning something!!!
Post #1453001
Posted Wednesday, May 15, 2013 7:08 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 9:20 AM
Points: 1,918, Visits: 1,439
WWDMark (5/15/2013)
kapil_kk (5/15/2013)
Lokesh Vij (5/15/2013)
I found Today's question relatively easier than yesterday. :)
true


+1 to that but I was looking for a catch somewhere in the answers though (paranoid much!!)


+1. Great question, but I spent some time looking for the "got'cha" before answering.




Everything is awesome!
Post #1453077
Posted Wednesday, May 15, 2013 7:14 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:22 PM
Points: 4,016, Visits: 5,311
Enjoyed this one too, thanks Hugo

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1453080
Posted Wednesday, May 15, 2013 7:50 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 9:38 AM
Points: 2,104, Visits: 2,113
Nice follow up Hugo. I didn't over-think it today.

A minor typo in the explanation.
"... As soon as one evaluates to True, the corresponding ELSE is returned. ..."

ELSE should be THEN in that sentence.

Enjoy!



Post #1453104
Posted Wednesday, May 15, 2013 8:39 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Wednesday, September 24, 2014 8:42 AM
Points: 539, Visits: 809
Good question, thanks.

Hakim Ali
www.sqlzen.com
Post #1453136
Posted Wednesday, May 15, 2013 8:46 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 11:29 AM
Points: 3,354, Visits: 2,001
Nice question Hugo. I use a lot of case statements so these are always fun to navigate.
Post #1453144
Posted Wednesday, May 15, 2013 8:52 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 1:41 AM
Points: 1,317, Visits: 629
In the Explanation: "A CASE expression will always evaluate the WHEN clauses from top to bottom. As soon as one evaluates to True, the corresponding [ELSE] is returned."

I think it should be the corresponding [THEN] not else, correct me if I am wrong.

And many thanks to SSC editors who put those 2 nice questions back to back to get the most benefit out of it.

Regards,
Hany Helmy
Post #1453153
Posted Wednesday, May 15, 2013 9:03 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 8:36 AM
Points: 1,415, Visits: 802
I too lokked for the catch, didn't find one so submitted my answer.
Thanks for the 2 points Hugo.

(Well, some question setters do try to catch us out don't they?)
Post #1453164
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse