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 ««123»»

Coalesce and Conversion Expand / Collapse
Author
Message
Posted Tuesday, January 08, 2013 7:20 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 8:46 AM
Points: 8,547, Visits: 8,204
Good question Tom. Good to have a refresher on these things from time to time.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1404232
Posted Tuesday, January 08, 2013 8:25 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: 2 days ago @ 1:49 AM
Points: 3,123, Visits: 4,310
Tripped myself on this one.
Thanks Tom, learned something today, so I guess that makes it worthwhile


____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1404277
Posted Tuesday, January 08, 2013 9:14 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 10:57 AM
Points: 1,632, Visits: 10,850
Excellent question, and great explanation! Thanks!


Rob Schripsema
Accelitec, Inc
Post #1404316
Posted Tuesday, January 08, 2013 10:32 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Wednesday, April 17, 2013 10:57 PM
Points: 1,491, Visits: 3,008
How annoying. You made me think! ;)

I agree this was an excellent question and explanation. I do see that one minor correction could be needed to one example given, however. You say "...for example the numeric value 37.2 can be converted to an int (37)...". Did you actually mean that an INT (@i) could be converted to the higher precedence numeric type, as obviously could be the literal value 37.2? After all, the result of that coalesce is 37.2 and not 37.
Post #1404373
Posted Tuesday, January 08, 2013 12:07 PM


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: 2 days ago @ 11:46 AM
Points: 3,448, Visits: 2,522
A really good QotD. Thanks, Tom!
Post #1404418
Posted Tuesday, January 08, 2013 10:07 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 12:58 AM
Points: 1,169, Visits: 1,244
Very nice question Tom. Learnt something new today

~ Lokesh Vij

Guidelines for quicker answers on T-SQL question
Guidelines for answers on Performance questions

Link to my Blog Post --> www.SQLPathy.com

Follow me @Twitter

Post #1404540
Posted Tuesday, January 08, 2013 10:20 PM


SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, January 24, 2013 6:08 AM
Points: 28, Visits: 136
thanks good and very tough question!

_______________________________________________________________
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." – Bill Gates
Post #1404541
Posted Wednesday, January 09, 2013 12:01 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 7:28 AM
Points: 2,637, Visits: 1,632
Great question, must say. +1
Post #1404562
Posted Wednesday, January 09, 2013 7:03 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 9:56 AM
Points: 443, Visits: 1,191
Interesting question, thank you Tom.

(even kind of knowing the output for each select statement, it tempted me to challenge self and to prove it)


ww; Raghu
--
There are only 10 types of people in the world, those who understand binary, and those who don't.

Note: (as of now) only.. 1 and 4 applies (i am on my way...)
Post #1404756
Posted Wednesday, January 09, 2013 7:35 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, May 16, 2013 2:52 PM
Points: 1,350, Visits: 870
Thanks for the great question Tom. It really made me think; there were so many choices and it was so early in the morning. I can definitely say I'm awake now.



Oh no, we're toast! I've got this. *Keyboard clatter* Woah, how'd you do that? I'm a DBA...Booyah

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

Post #1404786
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse