FORMAT that string

  • Comments posted to this topic are about the item FORMAT that string

  • Hmmm, can you double check that answer Steve? Nice presentation on SQL In the City by the way. Hope your cough went away!

  • Similarly confused!?

    ...

  • What's the result of the following query?

    SELECT FORMAT(COUNT(*),'#')
    FROM HolydaysToDo
    WHERE HolydaysToDo.Name = 'Steve Jones'

    The result:
    Arithmetic overflow error converting expression to data type bigint

    A lot of days

    πŸ˜€πŸ˜€

  • Although I never use the format function because of it's horrific performance, I am pretty certain that the alleged answer is not the correct one.
    😎

  • Joining the throng of questions on the answer here!!! I'm pretty sure it is currently wrong!

  • Yet another wrong QoTD.

  • Gah, not sure what I was thinking. Must have gotten distracted as I was moving the code over. Corrected. The answer and explanation should be 0####

  • Glad i answered after the correction was applied.
    Nice question, thanks Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    β€œlibera tute vulgaris ex”

  • I too answered after it was corrected and got it right.

    But ...  storing zip codes in a numeric field?  Bah.  Just because something is made up of numerals (like a zip code, phone number, ssn) doesn't mean it's numeric.  Store the data correctly and you won't need to format it.

  • The correct answer should be E. None of the above.  Store postal codes as string values.

  • Jedak - Thursday, March 1, 2018 7:52 AM

    The correct answer should be E. None of the above.  Store postal codes as string values.

    And don't use FORMAT

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Jedak - Thursday, March 1, 2018 7:52 AM

    The correct answer should be E. None of the above.  Store postal codes as string values.

    Amen to that. They often contain a four digit group separated by a dash.

  • Should != reality. Unfortunately.

  • Revenant - Thursday, March 1, 2018 9:06 AM

    Jedak - Thursday, March 1, 2018 7:52 AM

    The correct answer should be E. None of the above.  Store postal codes as string values.

    Amen to that. They often contain a four digit group separated by a dash.

    and outside the USA they could contain anything...

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

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