Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Extracting a Numeric Reference from a VARCHAR field Expand / Collapse
Author
Message
Posted Monday, November 24, 2008 3:09 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, June 16, 2014 4:03 AM
Points: 488, Visits: 403
I'm glad that this QOTD caused some deep thinking. It was prompted by a real-life problem, although it wasn't as constrained as I made it. The original input field was VARCHAR255) and failing on convert to INT when it had about 30 digits. The code was so bad that most would have seen the potential flaws. On playing with a way to fix it, I realised how (just about) useless ISNUMERIC is.
What's the proper solution? I haven't actually worked that out! LOL

I like writing QOTD (okay, I've only done 2 so far!) where you can't easily cheat by just paste-and-go (like, umm, the author has been know to do).
I'm working on another one using date formats. Sadly, I have to work for a living so progress isn't as quick as I would like. Still, watch this space!

Regards

Brewmanz
Post #607383
Posted Monday, November 24, 2008 3:21 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, July 17, 2014 10:36 PM
Points: 5,308, Visits: 1,378
Nice one...:)


Post #607388
Posted Thursday, June 25, 2009 12:24 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 4:08 PM
Points: 8,573, Visits: 9,081
brewmanz (11/24/2008)
I'm glad that this QOTD caused some deep thinking. It was prompted by a real-life problem, although it wasn't as constrained as I made it. The original input field was VARCHAR255) and failing on convert to INT when it had about 30 digits. The code was so bad that most would have seen the potential flaws. On playing with a way to fix it, I realised how (just about) useless ISNUMERIC is.
What's the proper solution? I haven't actually worked that out! LOL

I like writing QOTD (okay, I've only done 2 so far!) where you can't easily cheat by just paste-and-go (like, umm, the author has been know to do).
I'm working on another one using date formats. Sadly, I have to work for a living so progress isn't as quick as I would like. Still, watch this space!

Regards

Brewmanz


Definitely one of the better QOTD. The type of teh case statement was obviously wrong but easily fixable by changing the line marked (A), so it would be easy to go for the wrong answer without thinking about the real meaning of isNumeric. And thd explanation of teh anser is clear and correct. I liked this one very much.


Tom
Post #742101
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse