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 Kenneth Fisher
»
String Length
43 posts, Page 1 of 5
1
2
3
4
5
»
»»
String Length
Rate Topic
Display Mode
Topic Options
Author
Message
Kenneth.Fisher
Kenneth.Fisher
Posted Tuesday, July 10, 2012 10:05 PM
Hall of Fame
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 2:29 PM
Points: 3,367,
Visits: 1,575
Comments posted to this topic are about the item
String Length
Kenneth Fisher
I strive to live in a world where a chicken can cross the road without being questioned about its motives.
--------------------------------------------------------------------------------
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Link to my Blog Post -->
www.SQLStudies.com
Post #1328021
Samith C
Samith C
Posted Tuesday, July 10, 2012 10:36 PM
SSC Veteran
Group: General Forum Members
Last Login: Wednesday, January 16, 2013 11:36 PM
Points: 234,
Visits: 110
Nice Question
There is no Wrong time to do a Right thing :)
Post #1328024
rhythmk
rhythmk
Posted Tuesday, July 10, 2012 11:12 PM
Old Hand
Group: General Forum Members
Last Login: Saturday, November 10, 2012 9:30 AM
Points: 388,
Visits: 603
Very good question.Refreshed the basics.
I was not sure about middle two but sure about first two(7,7) and last two(14,80).
So objective approach which I developed from Engineering Entrance Exam worked and got the right answer
--rhythmk
------------------------------------------------------------------
To post your question use below link
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1328036
Iulian -207023
Iulian -207023
Posted Wednesday, July 11, 2012 12:00 AM
SSC Eights!
Group: General Forum Members
Last Login: Thursday, June 13, 2013 6:47 AM
Points: 847,
Visits: 770
Nice one , thanks
Iulian
Post #1328049
Koen Verbeeck
Koen Verbeeck
Posted Wednesday, July 11, 2012 12:13 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 6:30 AM
Points: 9,410,
Visits: 6,495
Great question, thanks!
How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
Member of
LinkedIn
. My blog at
LessThanDot
.
MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1328056
paul.knibbs
paul.knibbs
Posted Wednesday, July 11, 2012 1:34 AM
Ten Centuries
Group: General Forum Members
Last Login: Today @ 8:56 AM
Points: 1,270,
Visits: 4,303
I thought the 4th one would be 8 at first, but since 7, 7, 8, 8, 14, 80 wasn't an option had to go by a process of elimination to find the right answer! Slightly odd behaviour from nchar() there, I learned something...
Post #1328086
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
Posted Wednesday, July 11, 2012 1:37 AM
Hall of Fame
Group: General Forum Members
Last Login: Thursday, June 13, 2013 9:46 AM
Points: 3,157,
Visits: 4,341
Good back-to-basics question, thanks
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1328088
Stuart Davies
Stuart Davies
Posted Wednesday, July 11, 2012 2:43 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 1:11 PM
Points: 2,499,
Visits: 2,198
Good question - thanks
-------------------------------
Posting Data Etiquette - Jeff Moden
Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
Post #1328111
Hardy21
Hardy21
Posted Wednesday, July 11, 2012 2:52 AM
SSC Eights!
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 7:11 AM
Points: 877,
Visits: 1,159
Nice & Easy
Thanks
Post #1328115
Hugo Kornelis
Hugo Kornelis
Posted Wednesday, July 11, 2012 3:05 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 5,293,
Visits: 7,229
paul.knibbs (7/11/2012)
Slightly odd behaviour from nchar() there, I learned something...
Hmmm, not sure why you this is strange behaviour for nchar. It is fixed length, so any shorter length string put into it has to be padded. And if you then concatenate another string, it will of course go after the original string (which includes the padding). If you don't want the padding to be in there, use LTRIM() (or use nvarchar instead of nchar, obviously).
In my opinion, it is LEN() that has the strange behaviour here, because it returns the length of the padded version of the string instead of the length of the string itself. This almost caused me to give the wrong answer - but I recalled just in time the number of times I have already been bitten by this strange behaviour of LEN().
Thanks for a good question, Kenneth!
Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog:
http://sqlblog.com/blogs/hugo_kornelis
Post #1328127
« Prev Topic
|
Next Topic »
43 posts, Page 1 of 5
1
2
3
4
5
»
»»
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.