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 @ 7:26 AM
Points: 1,658, Visits: 6,002
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: Yesterday @ 6:04 AM
Points: 3,517, Visits: 2,606
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: 2 days ago @ 1:54 AM
Points: 830, Visits: 1,144
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 @ 7:10 AM
Points: 1,714, Visits: 1,245
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.




Yeah, uh huh, you know what it is. Everything I do, I do it big

Post #1453077
Posted Wednesday, May 15, 2013 7:14 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: Today @ 5:25 AM
Points: 3,683, Visits: 4,817
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


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 6:43 AM
Points: 1,885, Visits: 1,861
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: Monday, April 14, 2014 7:20 AM
Points: 508, Visits: 744
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 @ 9:46 AM
Points: 3,150, Visits: 1,900
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


SSC Eights!

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

Group: General Forum Members
Last Login: Yesterday @ 2:16 AM
Points: 922, Visits: 378
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, April 01, 2014 9:09 AM
Points: 1,337, Visits: 746
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