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


ISNUMERIC() and REPLICATE()


ISNUMERIC() and REPLICATE()

Author
Message
crashdan
crashdan
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1020 Visits: 757
dun (11/24/2009)
That's a big number. How do you report that on your financials? Numbers represented in $000,000,...,000,000? :-P

It made me do a search on the net for big number names (see http://www.sizes.com/numbers/big_numName.htm). It was interesting to find that the number 1 billion can mean something different in other countries. Fantastic.


You have now ruined my morning ... HAHA ... i am doing the same.
Dude76
Dude76
Old Hand
Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)

Group: General Forum Members
Points: 334 Visits: 94
Not an every day problem for us (hi from France ^^ ), but as we have to communicate in english for international, it is an usual question BigGrin


My MCP Transcript (ID : 692471 Access : 109741229)
crashdan
crashdan
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1020 Visits: 757
crussell-931424 (11/24/2009)
Any number of zeros returns 1. So if it is smart enough to know that all the characters are zero and thus must be a number why can't it just check all the characters individually to see if they are 0 to 9? Or is there no such thing as a number larger than a float's maximum value? I just now noticed that it strips away all leading zeros. I guess that answers my own question.

SELECT ISNUMERIC(REPLICATE('0', 7690) + REPLICATE('1', 310)) returns 0

SELECT ISNUMERIC(REPLICATE('0', 7691) + REPLICATE('1', 310)) returns 1

The reason then that the second one returns 1 is that there are really only 309 of them. It only considers the first 8000 characters of the string, meaning there are really only 309 of the digit 1, which we already know returns a 1.


i agree 0= 000 but 1 <> 111
Steve Jones
Steve Jones
SSC Guru
SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)SSC Guru (143K reputation)

Group: Administrators
Points: 143276 Visits: 19424
It's a bug in the engine, and I'm not sure how many people will run across it, but it might be nice to know this.

The explanation has been changed.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.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