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 @ 10:21 AM
Points: 1,767, Visits: 6,387
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: Thursday, September 25, 2014 7:41 AM
Points: 3,545, Visits: 2,653
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 @ 3:32 AM
Points: 900, Visits: 1,252
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 @ 3:53 PM
Points: 1,899, Visits: 1,424
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


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 @ 1:05 PM
Points: 3,984, Visits: 5,237
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 @ 8:45 AM
Points: 2,085, Visits: 2,082
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: Today @ 4:46 PM
Points: 3,339, Visits: 1,994
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 @ 4:51 AM
Points: 1,284, Visits: 610
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: Yesterday @ 5:56 AM
Points: 1,415, Visits: 801
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