|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Friday, April 26, 2013 5:51 AM
Points: 688,
Visits: 162
|
|
| Thanks for the question. I ran in to a similar situation while creating a query last week.
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Tuesday, January 15, 2013 11:11 AM
Points: 1,945,
Visits: 2,782
|
|
this is why we use || in ANSI Standard SQL for concatenation.
Books in Celko Series for Morgan-Kaufmann Publishing Analytics and OLAP in SQL Data and Databases: Concepts in Practice Data, Measurements and Standards in SQL SQL for Smarties SQL Programming Style SQL Puzzles and Answers Thinking in Sets Trees and Hierarchies in SQL
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Today @ 11:36 AM
Points: 837,
Visits: 1,219
|
|
Nice question, and a nice example showing that data type issues don't always result in an error. Implicit conversion isn't always your friend.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 9:31 AM
Points: 1,041,
Visits: 1,356
|
|
Prassad Dabbada V R (8/21/2012) I thought it will conevert everything to int. As the expression eveluates from right to left so from the right first plus will return 121 (120 will be converted to int) and so on and so forth. but unfortunately my guess is wrong.
No, expressions evaluate from left to right.
I got it wrong because I'm so used to shortcutting the addition of 3 numbers in my head that I for some reason thought SQL Server could do the same. Too early in the morning, not enough coffee, {{insert additional generic excuse}}.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Today @ 8:11 AM
Points: 456,
Visits: 157
|
|
Good question..! I m woundering why almost 50% attempts are wrong.
Best, Naseer Ahmad SQL Server DBA
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 9:52 AM
Points: 1,356,
Visits: 4,761
|
|
sestell1 (8/21/2012) Implicit conversion isn't always your friend.
Implicit conversion isn't ever your friend!
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 5:48 AM
Points: 1,076,
Visits: 1,922
|
|
Nice question . Thanks.
- Divine Flame
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Thursday, May 02, 2013 3:45 PM
Points: 3,748,
Visits: 928
|
|
Nice question, learned something new today. I was quite sure the answer would be 251, but then I remembered data type precedence may be tricky.
Toreador (8/21/2012)
sestell1 (8/21/2012) Implicit conversion isn't always your friend.
Implicit conversion isn't ever your friend! Implicit conversion isn't even your friend! 
"El" Jerry.
"A watt of Ottawa" - Gerardo Galvan
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Today @ 1:05 PM
Points: 703,
Visits: 694
|
|
good and easy question, thanks
-------------------------------------- "Stay Hungry, Stay Foolish." ― Jobs “Everything has beauty, but not everyone sees it.” ― Confucius
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 10:59 AM
Points: 2,579,
Visits: 1,537
|
|
| Nice question about the basics. Thanks!
|
|
|
|