Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Anuj Rathi
»
LEN()
19 posts, Page 2 of 2
««
1
2
LEN()
Rate Topic
Display Mode
Topic Options
Author
Message
Daniel Bowlin
Daniel Bowlin
Posted Tuesday, June 15, 2010 7:46 AM
SSCrazy
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 1:10 PM
Points: 2,673,
Visits: 2,418
rjv_rnjn (6/15/2010)
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
Good point. In a month or so, this RTRIM/LTRIM variation would be a good question, after everyone has forgotten this question, and its discussion.
Post #937505
webrunner
webrunner
Posted Tuesday, June 15, 2010 7:51 AM
SSCrazy
Group: General Forum Members
Last Login: Yesterday @ 1:47 PM
Points: 2,118,
Visits: 2,213
F1Droid (6/15/2010)
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!
Yes, the same thing happened to me.
- webrunner
-------------------
"The chemistry must be respected." - Walter White
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'"
Ref.:
http://tkyte.blogspot.com/2009/02/sql-joke.html
Post #937512
SanjayAttray
SanjayAttray
Posted Tuesday, June 15, 2010 7:56 AM
Hall of Fame
Group: General Forum Members
Last Login: Friday, March 15, 2013 2:43 PM
Points: 3,924,
Visits: 1,554
Easy basic programming RTRIM question.
SQL DBA.
Post #937516
Michael Poppers
Michael Poppers
Posted Tuesday, June 15, 2010 8:13 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Thursday, January 17, 2013 2:34 PM
Points: 565,
Visits: 360
UMG Developer (6/14/2010)
...I probably would have had the second option be 5, 2, 3...
Agreed. I think 5,2,5 makes no sense and should influence a decision in favor of 5,2,2.
Post #937539
Rose Bud
Rose Bud
Posted Tuesday, June 15, 2010 9:48 AM
Ten Centuries
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:42 AM
Points: 1,072,
Visits: 1,026
As usual, I learn more from the discussion than the original question.
If this had been the question:
SET @aa = 'abcde';SET @bb = ' ab';SET @cc = 'ab '
I would have gotten it wrong.
(I meant no disrespect to the author of the question. My point was that a thread of "what if this" and "what if that" is always educational.)
Post #937643
Trey Staker
Trey Staker
Posted Tuesday, June 15, 2010 4:54 PM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 4:52 PM
Points: 1,379,
Visits: 2,626
wware (6/15/2010)
As usual, I learn more from the discussion than the original question.
If this had been the question:
SET @aa = 'abcde';SET @bb = ' ab';SET @cc = 'ab '
I would have gotten it wrong.
I was a bit nervous before I answered the question that there was more to the question like what your example was.
---------------------------------------------------------------------
Use Full Links:
KB Article from Microsoft on how to ask a question on a Forum
Post #937878
SQLRNNR
SQLRNNR
Posted Wednesday, June 16, 2010 9:30 PM
SSCoach
Group: General Forum Members
Last Login: Yesterday @ 10:25 AM
Points: 18,754,
Visits: 12,337
Thanks for the QOD
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #938634
antony-688446
antony-688446
Posted Tuesday, June 22, 2010 3:59 PM
SSC Veteran
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 7:26 PM
Points: 254,
Visits: 277
Made me question the way char's are handled in len() as we always use varchar, so thanks!
Post #941393
Dhruvesh Shah
Dhruvesh Shah
Posted Monday, October 04, 2010 7:33 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Wednesday, July 25, 2012 9:04 PM
Points: 542,
Visits: 187
i thought ans would be 5 2 3 but as it wasn't present i have to search and found that space is ignored
would have been better if we have option of 5 2 3. many of us would have got that wrong
Post #997546
« Prev Topic
|
Next Topic »
19 posts, Page 2 of 2
««
1
2
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.