Length

  • If the question's author is a politician then it all makes perfect sense.

  • If people can post questions to a wide audience without bothering to test them you worry what state their database code must be in.

  • Scott Arendt (4/8/2011)


    tilew (4/7/2011)


    What I don't understand, is why SQL told me that the lenght is 4, but microsoft says "the storage size, in bytes, is two times the number of characters entered + 2 bytes. " So, it should be (2 caracters * 2) + 2, that would make 6 bytes... (But there were no "6" bytes answer, so I answered 4)-D

    That was my exact reasoning. If there was an option to select 6 as the answer, I would have "earned" my incorrect answer.

    Interesting that datalength does not return the storage size, but the number of bytes used to represent any expression. At least I learned something new today.

  • mohammed moinudheen (4/8/2011)


    JBregman (4/8/2011)


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

    Jaap.

    No personal attacks please.

    I think he was just playing with Steve - just a little humor.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Cliff Jones (4/8/2011)


    Hey, April Fools was LAST Friday!

    Maybe it should be all month long - great comment.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Steve, is there a way to make 4 count as the correct answer and correct the results?

  • Scott Arendt (4/8/2011)


    tilew (4/7/2011)


    What I don't understand, is why SQL told me that the lenght is 4, but microsoft says "the storage size, in bytes, is two times the number of characters entered + 2 bytes. " So, it should be (2 caracters * 2) + 2, that would make 6 bytes... (But there were no "6" bytes answer, so I answered 4)-D

    That was my exact reasoning. If there was an option to select 6 as the answer, I would have "earned" my incorrect answer.

    It's the DATALENGTH function, not the storage size. The data length of an NVARCHAR (or NCHAR) is twice the number of characters entered. That's my assumption for the explanation at least.

  • Agree with all the comments below. This was not nchar, but nvarchar, which means variable. The answer given as correct would have been true for nchar. I want my point!!

  • pmcwhorter (4/8/2011)


    Where is the quality control on this forum for verifying correct answers?

    From what I've seen, big part of the quality control is in the people that answer the question. Yes, the person that posted it should be careful to make sure it's right but mistakes are made and I can understand the admins on this free site not going through and vetting every question posted. No worries. When Steve has time he'll get in and correct it. It's annoying but other than pride over the lost point or frustration at someone having made a mistake there really isn't any adverse result of this.

  • Argh! How does something this simple and wrong make it through. Did nobody actually run the code prior to posting the question?

    Steve, oh Steve, Cleanup on isle 42.

    I don't do aisle clean-ups 🙂 . Oh, you meant Mr. Jones 😀

  • I want my money back :w00t:

  • ambigla (4/7/2011)


    Today I thought "Finally! An easy one!!" and specified 4 only to find out the question wasn't checked properly and I ended up getting it wrong anyway :crazy: It's not the end of the world but it is kinda fail that nobody bothered to at least double check the answer.

    Quickly correct it before any other poor souls stumble across it.

    I'm sorry to report that poor souls are still stumbling! I usually wait and answer the QOTD after lunch to give questions/explanations time for any necessary 'scrubbing.' I guess I should have held off longer before attempting this one.

    I usually don't chime in with 'me, too' comments but I couldn't bite my tongue on this one.

  • i surprised by the question posted ................

    answers not matching with question posted................:w00t:

  • Question is about nvarchar. Correct answer to that question is 4, which I picked.

    Purported answer is about nchar, which is different, and not simply a typo. Author of question suffers from failure to understand, or failure to do QA.

    I want my points.

  • I saw that my answer was the same as 70% of the answers so figured I definently had it correct. Surprise, Surprise. Well we all make mistakes. I am sure Steve will correct it.

Viewing 15 posts - 76 through 90 (of 138 total)

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