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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:29 AM
Points: 11,994, Visits: 11,012
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
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
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: Friday, April 18, 2014 6:40 AM
Points: 3,683, Visits: 4,818
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: Today @ 9:43 AM
Points: 1,906, Visits: 10,943
Excellent question, and great explanation! Thanks!


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


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, January 21, 2014 8:55 AM
Points: 1,520, Visits: 3,035
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


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:50 AM
Points: 4,245, Visits: 3,327
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: Wednesday, April 09, 2014 2:46 AM
Points: 1,371, Visits: 1,547
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


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: Wednesday, April 16, 2014 6:04 AM
Points: 3,517, Visits: 2,606
Great question, must say. +1
Post #1404562
Posted Wednesday, January 09, 2013 7:03 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Friday, April 18, 2014 10:45 AM
Points: 673, Visits: 1,551
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


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 7:37 AM
Points: 1,720, Visits: 1,249
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.



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