July 25, 2008 at 5:13 am
We recently stumbled across a problem in our data where we'd uploaded a file with a comma instead of a decimal point in a number into a varchar field. Yes, I know it should have been in a decimal field if we're going to deal with it as a number and yes, I know it should be validated but that's not the point of the question.
My question is more about understanding SQL Server.
Why does this:
SELECT ISNUMERIC ('5,0')
return true, yet this:
SELECT CAST('5,0' AS DECIMAL(20,10))
fails because it's not a number?
July 25, 2008 at 5:27 am
Hi John
The shortfalls of ISNUMERIC have been discussed many times before. This should help:
http://www.sqlservercentral.com/Forums/Topic456023-338-1.aspx
Cheers
ChrisM
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 25, 2008 at 5:36 am
thanks chris, that makes sense now i think about it. next time that catches me out i'll know why !!
cheers
John
July 25, 2008 at 5:42 am
You're welcome John, thanks for the feedback.
There's a searchbox in the top right corner of the forum pages, if you enter ISNUMERIC Moden, you will get a whole bunch of useful discussion and lots of testing to support the conclusions.
Cheers
ChrisM
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply