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

concatenation Expand / Collapse
Author
Message
Posted Monday, August 20, 2012 8:15 PM
SSC-Addicted

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

Group: General Forum Members
Last Login: Wednesday, October 29, 2014 3:41 AM
Points: 407, Visits: 79
Comments posted to this topic are about the item concatenation
Post #1347534
Posted Monday, August 20, 2012 8:16 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, November 6, 2014 1:00 PM
Points: 5,333, Visits: 25,277
Nice question .. good to be reminded of the fundamentals / basic stuff ..

Thanks


If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1347535
Posted Monday, August 20, 2012 9:52 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, December 2, 2014 9:20 AM
Points: 1,372, Visits: 1,567
Good question

Its always wonderfu to brush up our fundamentals


~ 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 #1347550
Posted Tuesday, August 21, 2012 1:10 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, August 25, 2014 4:06 AM
Points: 314, Visits: 164
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.
Post #1347598
Posted Tuesday, August 21, 2012 1:33 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 3:24 AM
Points: 1,156, Visits: 1,133
Good question. More learning for me.
Post #1347604
Posted Tuesday, August 21, 2012 2:40 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 4:13 AM
Points: 4,156, Visits: 5,549
good back-to-fundamentals question
Thanks, Yousaf


____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1347636
Posted Tuesday, August 21, 2012 2:55 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 1:57 AM
Points: 1,298, Visits: 2,269
A good question (which I got wrong ), but I think that these references better explain what's happening:

http://msdn.microsoft.com/en-us/library/ms190276 (operator precedence)
http://msdn.microsoft.com/en-us/library/ms190309 (data type precedence)

When two operators have the same precedence (as concatenate and add do), then they are evaluated from left to right, so the first plus (concatenate) is done first. When the second plus is evaluated, data type precedence is considered and Int trumps String.
Post #1347640
Posted Tuesday, August 21, 2012 2:59 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, August 27, 2013 4:28 AM
Points: 1,248, Visits: 779
Yay! I like these questions I can answer in the blink of an eye... now, back to work.

Thanks for today's question


_____________________________________________________________________
"The difficult tasks we do immediately, the impossible takes a little longer"
Post #1347641
Posted Tuesday, August 21, 2012 4:05 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: Thursday, June 12, 2014 4:19 AM
Points: 701, Visits: 1,145
Good question. Need to remember the basics.
Post #1347668
Posted Tuesday, August 21, 2012 4:06 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 2:32 PM
Points: 6,128, Visits: 8,393
A good question. I'll admit that I am surprised at the high number of incorrect answers; I would have expected 70 to 80 percent to get this right.
I'm not surprised that the wrong answers are fairly evenly divided over the wrond answers; they are all very good distractors. Well done!

And Andrew, thank you for providing the links and explanation that really explain the results; they are a good addition to the explanation and references given bij Yousaf.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1347669
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse