Numbers

  • Comments posted to this topic are about the item Numbers

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • Thank goodness for Jeff Moden's writing in the series of articles called "SPACKLE"

    Speakiing of thos short but SO INFORMATIVE ARTICLES, what happend to the entry in the left most frame linking to that series of articles?

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • It's nice to be reminded of these things. I think I would prefer to not have the implied conversions though.

    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

  • Good question but I couldn't find pound symbol on my keyboard.

    M&M

  • This was removed by the editor as SPAM

  • Thanks for the question, Stuart!

    To expand a bit on the explanation, ISNUMERIC determines if a string value can be converted to a numeric data type - any numeric data type. But it does not specify which data type the expression can be converted to.

    The dollar and pound sign are valid in conversion from string to money or smallmoney (normally followed by the actual amount); the dot is valid in conversion from string to any non-integer data type (normally preceded by the whole part and followed by the fractional part). Without the numbers, the conversion will result, as Stuart already wrote, in the value zero.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Good Question...

  • Got me there with the '.' :satisfied:

    ---------------
    Mel. 😎

  • Good question.

    But I don't like the wording of the first sentence of the explanation: "...an expression is a valid numeric type"; well, 1 is not a valid numeric type, it's a numeric literal representing a value (or values, if your version of type theory doesn't allow types which overlap) belonging to several numeric types. And '$' is not a valid numeric type, it's a string literal which can be used to represent a value of the money (or smallmoney) type; and so on.

    I almost fell over on '#', thinking something like "surely SQL has an octal form for integer literals, does it begin with a #"; but then I noticed that all 1s wasn't an option, which, since all the others clearly are numeric, forced me to remember that SQL is a bit more modern than my early days in computing.

    Those days of course were right back when many machines didn't use the 8 bit bytes for which hexadecimal is a sensible form, octal was widely used for machines with 6 bit characters and 24-bit or 36-bit words and often indicated by # and there were various 6-bit character codes which existed alongside alongside the machines using various 8 bit character codes and 16 bit and 32 bit words which used hex. Even 5-bit characters were often used in data comms (because telex was based on them so there were async modems which had 5 data bits per character hardwired) although I never came across a machine where the wordlength was a multiple of 5 or base 32 numeric string literals were used.

    Tom

  • bitbucket-25253 (1/3/2012)


    Thank goodness for Jeff Moden's writing in the series of articles called "SPACKLE"

    To perhaps save someone a few minutes of searching, a link[/url]... thank you very much for mentioning the article series!

  • L' Eomot InversΓ© (1/4/2012)


    Good question.

    But I don't like the wording of the first sentence of the explanation: "...an expression is a valid numeric type". . . .

    Know what you mean Tom - but I took the wording straight from BOL (I know, a scarely used resource πŸ™‚ ) to try and avoid any arguments

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • Very interesting question. Thanks.

  • Good explanation Hugo.

    http://brittcluff.blogspot.com/

  • Stuart Davies (1/4/2012)


    Know what you mean Tom - but I took the wording straight from BOL (I know, a scarely used resource πŸ™‚ ) to try and avoid any arguments

    For sake of completeness, here's also the link to BOL.

    Anyway, Jeff's explanation in his SQL Spackle is definitely better and more entertaining :-)--so thanks to Jeff for his efforts and time and to Rich for sharing the link (and saving me the time to search for it myself).

    Last but not least a great big thank you to Stuart for his QotD.

    -Michael

  • thanks for the question - definitely good reminder too Hugo. - Cheers

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

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