SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Explanation of LIKE '%[0-9]%'?


Explanation of LIKE '%[0-9]%'?

Author
Message
Eugene Elutin
Eugene Elutin
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5090 Visits: 5478
[b]Solomon Rutzky (7/27/2013)

  • 23847234872893475983479583749583749573945739 is all digits, is a valid number, but is NOT convertible to any SQL Server number types as it is larger than 38 digits


  • ...


    You can convert it to float (with lose of some precision ;-))

    select cast('23847234872893475983479583749583749573945739'  as float)



    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help
    Jeff Moden
    Jeff Moden
    SSC Guru
    SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

    Group: General Forum Members
    Points: 88196 Visits: 41128
    Eugene Elutin (7/29/2013)
    [b]Solomon Rutzky (7/27/2013)

  • 23847234872893475983479583749583749573945739 is all digits, is a valid number, but is NOT convertible to any SQL Server number types as it is larger than 38 digits


  • ...


    You can convert it to float (with lose of some precision ;-))

    select cast('23847234872893475983479583749583749573945739'  as float)



    Considering that FLOAT only has 15 digits of precision, it'll be a pretty big loss. :-)

    --Jeff Moden

    RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
    If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

    Helpful Links:
    How to post code problems
    How to post performance problems
    Forum FAQs
    Eugene Elutin
    Eugene Elutin
    SSCertifiable
    SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

    Group: General Forum Members
    Points: 5090 Visits: 5478
    Jeff Moden (7/29/2013)
    Eugene Elutin (7/29/2013)
    [b]Solomon Rutzky (7/27/2013)

  • 23847234872893475983479583749583749573945739 is all digits, is a valid number, but is NOT convertible to any SQL Server number types as it is larger than 38 digits


  • ...


    You can convert it to float (with lose of some precision ;-))

    select cast('23847234872893475983479583749583749573945739'  as float)



    Considering that FLOAT only has 15 digits of precision, it'll be a pretty big loss. :-)


    I wouldn't call 1.32% a such "big loss" Hehe
    However you are right! It does depend! If this loss constitutes my interest in £ - I would probably die from heart-attack :-D

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help
    Jeff Moden
    Jeff Moden
    SSC Guru
    SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

    Group: General Forum Members
    Points: 88196 Visits: 41128
    Eugene Elutin (7/29/2013)
    Jeff Moden (7/29/2013)
    Eugene Elutin (7/29/2013)
    [b]Solomon Rutzky (7/27/2013)

  • 23847234872893475983479583749583749573945739 is all digits, is a valid number, but is NOT convertible to any SQL Server number types as it is larger than 38 digits


  • ...


    You can convert it to float (with lose of some precision ;-))

    select cast('23847234872893475983479583749583749573945739'  as float)



    Considering that FLOAT only has 15 digits of precision, it'll be a pretty big loss. :-)


    I wouldn't call 1.32% a such "big loss" Hehe
    However you are right! It does depend! If this loss constitutes my interest in £ - I would probably die from heart-attack :-D




    Heh... absolutely agreed but wasn't talking about the loss in "value" of the number. Was talking about the number of digits that would be lost when trying to determine if a long string could be checked for "IsAllDigits".

    --Jeff Moden

    RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
    If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

    Helpful Links:
    How to post code problems
    How to post performance problems
    Forum FAQs
    Solomon Rutzky
    Solomon Rutzky
    SSCommitted
    SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

    Group: General Forum Members
    Points: 1737 Visits: 2965
    Jeff Moden (7/29/2013)
    Eugene Elutin (7/29/2013)
    Jeff Moden (7/29/2013)
    Eugene Elutin (7/29/2013)
    [b]Solomon Rutzky (7/27/2013)

  • 23847234872893475983479583749583749573945739 is all digits, is a valid number, but is NOT convertible to any SQL Server number types as it is larger than 38 digits


  • ...


    You can convert it to float (with lose of some precision ;-))

    select cast('23847234872893475983479583749583749573945739'  as float)



    Considering that FLOAT only has 15 digits of precision, it'll be a pretty big loss. :-)


    I wouldn't call 1.32% a such "big loss" Hehe
    However you are right! It does depend! If this loss constitutes my interest in £ - I would probably die from heart-attack :-D




    Heh... absolutely agreed but wasn't talking about the loss in "value" of the number. Was talking about the number of digits that would be lost when trying to determine if a long string could be checked for "IsAllDigits".


    Hmm. I thought I had tested that one using CONVERT and that it errored, but I tried again and it worked. Thanks for mentioning that.

    I agree that the loss of precision (i.e. rounding up) is non-ideal but seems to happen with the decimal types: MONEY, SMALLMONEY, DECIMAL / NUMERIC. So not a true conversion in the sense of being able to convert it back to the exact same string, but technically it does fit into the datatype. So it still fits into what I was saying regarding the need to determine if the value expressed in the string is really a number with respect to the end purpose of that number.

    Take care,
    Solomon..

    SQL# - http://www.SQLsharp.com/
    Go


    Permissions

    You can't post new topics.
    You can't post topic replies.
    You can't post new polls.
    You can't post replies to polls.
    You can't edit your own topics.
    You can't delete your own topics.
    You can't edit other topics.
    You can't delete other topics.
    You can't edit your own posts.
    You can't edit other posts.
    You can't delete your own posts.
    You can't delete other posts.
    You can't post events.
    You can't edit your own events.
    You can't edit other events.
    You can't delete your own events.
    You can't delete other events.
    You can't send private messages.
    You can't send emails.
    You can read topics.
    You can't vote in polls.
    You can't upload attachments.
    You can download attachments.
    You can't post HTML code.
    You can't edit HTML code.
    You can't post IFCode.
    You can't post JavaScript.
    You can post emoticons.
    You can't post or upload images.

    Select a forum

































































































































































    SQLServerCentral


    Search