Length

  • Only one comment: I want back my points! :-D:-D:-D

  • Carlo Romagnano (4/8/2011)


    Only one comment: I want back my points! :-D:-D:-D

    Ditto. Every other comment I was about to say has already been said.

  • Well, the question was wrong, I guess Sriram was a bit hasty :w00t:. I for one am happy to have my otherwise almost immaculate record destroyed by such. Unless of course everyone else has the points awarded back.

    cheers,

    Iain

  • Answer is 4 based on the question. As a lot of people have commented, the answer is based on a different data type

  • Clearly for nvarchar the answer should be 4. I have even taken the liberty of running the code just to make sure I'm not losing it.

    Cheers.

    Trevor.

  • CirquedeSQLeil (4/8/2011)


    mohammed moinudheen (4/7/2011)


    Books online reference below.

    nvarchar [ ( n | max ) ]

    Variable-length Unicode character data. n can be a value from 1 through 4,000. max indicates that the maximum storage size is 2^31-1 bytes. The storage size, in bytes, is two times the number of characters entered + 2 bytes. The data entered can be 0 characters in length. The ISO synonyms for nvarchar are national char varying and national character varying.

    ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/81ee5637-ee31-4c4d-96d0-56c26a742354.htm

    Answer should be 6.

    The correct answer is 4 - run the code.

    Yes Jason, the answer should be 4

    M&M

  • JBregman (4/8/2011)


    Steve, are you responsible for QoD selections? Shame on you!

    Jaap.

    No personal attacks please.

    M&M

  • A simple Q but a wrong A

    I want my points

  • I agree.:-D:-D

    Rick Karpel

  • I answered 4 but i had the wrong answer.

    I tested it and the response is 4.

    I don't understand why the question is not tested!!

  • Almost made me really thank God for an easy Friday question, only to find that the question and the answer are based on two completely different data types! 🙁

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com

    Follow me on
    Twitter: @sqltwins

  • :hehe::-D:crazy::blink::crying::-P

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Was this a trick question designed to simulate the, ah, "impedance mismatch" between, say, developers and DBAs? (*sings* "You say NCHAR, I say NVARCHAR, let's call the whole thing off.")

    I'll add my vote for a recall on this bogus question,

    Rich

  • Question must be checked before posting ...

    Answer is based on nchar while question is based on nvarchar..

  • I agree with the first reply. The first thing I looked for was if it was a fixed string or VARiable string.

    I have been caught making the mistake of using the datalength to find the length of a string before.... those were some bad times.

Viewing 15 posts - 31 through 45 (of 138 total)

You must be logged in to reply to this topic. Login to reply