|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, November 20, 2012 1:53 AM
Points: 136,
Visits: 42
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 10:48 AM
Points: 10,990,
Visits: 10,578
|
|
Seems I never get tired of getting this sort of question wrong
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, August 16, 2012 10:11 PM
Points: 30,
Visits: 31
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 12:10 PM
Points: 7,185,
Visits: 7,285
|
|
Hugo Kornelis (3/25/2010)
Good question, but unfortunately the explanation is not entirely correct. Especially this part is very misleading: Also the preceding space is not considered while performing the operation. I agree. It's a good question and the answer is right, but that part of the explanation is wrong. Not sure why you say "especially that part". Are you suggesting that some other part is wrong too?
As you have seen, there is no leading space to be considered anywhere. However, even if there was, the words "is not considered" is misleading. I think we would all agree that converting the values '5', ' 5' and ' 5 ' to integer should all result in the value 5 - not because we expect the leading and trailing spaces to be "not considered", but because considering them or not is irrelevant, as they have no impact on the interpretation of the string as a number. I don't much like saying that the reason ' 5 ' represents the integer 5 despite its having leading and trailing spaces is that "considering them or not is irrelevant"; the reason is that when we consider them we see that they have no impact on the interpretation of the string as a number - if we didn't consider them how would we know that they have no effect, that it was safe to say the string represents the number 5?
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
http://es.linkedin.com/in/tomthomsonsoftware
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 12:01 PM
Points: 117,
Visits: 225
|
|
| 0 is false in this example
|
|
|
|