|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Friday, March 22, 2013 3:01 AM
Points: 93,
Visits: 163
|
|
| Comments posted to this topic are about the item LEN()
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 11:21 AM
Points: 2,163,
Visits: 2,148
|
|
Good question, thanks!
Though I probably would have had the second option be 5, 2, 3...
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, February 15, 2013 11:19 PM
Points: 9,
Visits: 64
|
|
what's new in this question ?????
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 2:11 AM
Points: 9,378,
Visits: 6,473
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 9:59 PM
Points: 1,354,
Visits: 1,299
|
|
This one got me. I selected 5,5,5 because I'm used to having padding spaces with the CHAR datatype. That's why I use Varchar instead when the contents of the column doesn't contain a consistent number of characters.
if you were to select them without the LEN function, you would get abcde ab... ab...
(the period was used to make spaces visible).
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Saturday, May 18, 2013 1:44 AM
Points: 953,
Visits: 1,875
|
|
| It's probably also worth pointing out that if you actually did want the physical length of the variables, you would use DATALENGTH() instead of LEN().
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 3:25 AM
Points: 1,165,
Visits: 731
|
|
Aargh!! Again my initial reaction was "that's easy it's 5,2,2 as LEN ignores spaces"... and then "hmmm, but that's too easy, there must be a trick in there"... and after a bit of reading went against my initial conclusion...
Doh!! 
Good lesson though... trust yourself!
_____________________________________________________________________ "The difficult tasks we do immediately, the impossible takes a little longer"
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, February 04, 2013 1:16 PM
Points: 47,
Visits: 34
|
|
Thanx a lot everyday I learn from you new things...
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 7:52 AM
Points: 1,715,
Visits: 61
|
|
| Yep, it only does an RTRIM, not an LTRIM.
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Monday, February 25, 2013 12:52 PM
Points: 513,
Visits: 426
|
|
crussell-931424 (6/15/2010) Yep, it only does an RTRIM, not an LTRIM.This variation to the question may have been a better teaser
|
|
|
|