July 10, 2014 at 9:23 pm
Comments posted to this topic are about the item Difference with DataLength and Len with CHAR and NVARCHAR Datatype
Regards,
Mitesh OSwal
+918698619998
July 10, 2014 at 11:41 pm
I have actually thought of this question yesterday :-), I am surprised to see it today.
(of course, I don't have plans to submit as QOTD)
July 11, 2014 at 12:17 am
Easy one for Friday, thanks
Thanks
July 11, 2014 at 12:41 am
Why is DATALENGTH() included in the question? The first two results are the same for all answers
Nice easy question to end the week, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 11, 2014 at 12:47 am
I agree, it's easier than it appears
July 11, 2014 at 2:18 am
Yeah, it would have made it a bit harder if there had been some variation in the first two numbers--that half of the question might as well have not been there!
July 11, 2014 at 3:25 am
thank you for the question
July 11, 2014 at 6:17 am
A nice and easy one to end the week. Thanks.
July 11, 2014 at 6:36 am
Easy question:-)
Manik
You cannot get to the top by sitting on your bottom.
July 11, 2014 at 7:17 am
Nice question, but there should have been a better trap answer. Too many obviously wrong. You could have done a 20,6,10,3 and it may have tripped up some people. A 10,3,3,3 may have gotten some people too.
July 11, 2014 at 7:38 am
Thanks for the question. Good one to end the week on.
July 11, 2014 at 8:01 am
Nice question, but I agree with others, there should have been some options where the DATALENGTH results varied. My first instincts (before seeing the available options) were 20,6,10,3, but when I saw that that wasn't one of the options, I thought about it some more and got the right answer.
July 11, 2014 at 12:07 pm
I'm surprised that you didn't include VARCHAR(10) in your question just to mix things up. FYI, both the datalength and the len are 3 and that is why I use it.
DECLARE @NCHAR NCHAR(10) ='ABC' ,
@NVARCHAR NVARCHAR(10) = 'ABC' ,
@VARCHAR VARCHAR(10) = 'ABC'
SELECT DATALENGTH(@NCHAR),
DATALENGTH(@NVARCHAR),
DATALENGTH(@VARCHAR),
LEN(@NCHAR),
LEN(@NVARCHAR) ,
LEN(@VARCHAR)
July 13, 2014 at 1:05 am
good question:-)
Viewing 15 posts - 1 through 15 (of 18 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy