Important alert: (current site time 7/15/2013 8:01:18 PM EDT)
 

article

ISNUMERIC is not “ALL DIGITS”

Email
Submitted on: 6/4/2006 6:01:00 AM
By: Jeff Moden 
Level: Advanced
User Rating: By 5 Users
Compatibility: SQL Server 2000
Views: 17781
 
     There are many cases where you need to ensure that the string data you are working with includes only numeric digits. Most Developers will use the built in ISNUMERIC function to make such a check. Here’s why that’s a bad idea and what to do about it.
 
winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
6/6/2006 2:10:24 AMVeeJay

Nice code. Is there a sure-fire way to insert or update dates without having to know the date format of the SQL Server. It often happens that the PC I am working on has a dd/MM/yyyy date format, but SQL Server (on a different machine has a date format of yyyy/MM/dd. How can I get around this?
(If this comment was disrespectful, please report it.)

 
6/6/2006 10:43:56 AMJeff Moden

No, sorry... There is not. When the DD is less than 13, there's no way to correctly interpret automatically. The best thing to do is to set all machines to produce the date in the YYYYMMDD ISO format. However, if you are using GETDATE() to create the dates, it won't matter because it always does it correctly (underlying date serial is always correct regardless of format).
(If this comment was disrespectful, please report it.)

 
6/16/2006 11:38:10 PMivan

i used to get around the problem by formating my client pc date to yyyy MMM dd. and it is always works. i have executable running in production and there is no problem report with that.
may be it could help
(If this comment was disrespectful, please report it.)

 
4/6/2009 7:57:48 PMJeff Moden

Heh... just an observation... it's been almost 3 years and more than 13,000 people have viewed this article. Yet only 4 have taken the time to rate it. Either people can't see where to rate the articles on this sight, or they just can't be bothered. Either way, it's amazing to me... and this isn't the only site where people just stab'n'grab.
(If this comment was disrespectful, please report it.)

 
11/12/2009 10:53:49 AMJulie

I bet one of the reasons so few people have voted is because they don't want to register with the site. Thanks for another excellent article, Jeff. I've learned so much from your contributions and it's greatly appreciated.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.