Field Lengths

  • Comments posted to this topic are about the item Field Lengths

  • Easy one. Thanks.

  • easy one, very easy point.....

    And, these kind of QOTD are already been posted...... 🙂

  • ksatpute123 (10/10/2013)


    Easy one. Thanks.

    +1

  • Easy one for Friday. Thanks

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • Nice question. I always mix up DATALENGTH and LEN.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • DATALENGTH provides exact length of the field if it is fixed length. If the field is of variable length, it returns the length of the data in the field

    It's not quite true. A variable of type CHAR is padded with blanks, so DATALENGTH returns the numbers of BYTES occupied by data with trailing SPACES.

    If you use NCHAR(10), e.g., DATALENGTH returns 20, because data take 20 bytes of storage.

  • Simple question, but wonder why the question was not just focused on column d and e and DATALENGTH and LEN.

  • This was removed by the editor as SPAM

  • +1 thanks....

    Manik
    You cannot get to the top by sitting on your bottom.

  • Nice question Steve. 🙂

    TGIF... Cheers... :satisfied:

  • I wonder what was the thinking behind the third answer?

    Why would someone think '10' will be returned if you entered '40' at the insert?

    Maybe I was just clever to read from the back 😛

  • Carlo

    You are correct in your statement. However, just wanted to give an easy overview explanation to the answer. I could have gone "real deep" in the explanation, but I thought not too.

    Again, thanks for the follow up 😉

  • All:

    Thank you for your responses. I thought an easy one for Friday would be fun and since a lot of "DBA's" (logical\physical\both) have issues with data\field storage, this would be a nice example. I just joined SQLServerCentral and I must say I have really enjoyed taking the quizzes, reading the articles, collaborating with my peers, etc. 😀

    Again, happy Friday to all and expect more from me.

    Regards,

    Steve

  • +1

Viewing 15 posts - 1 through 15 (of 21 total)

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