Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
Non-Numeric test |
Fri, Jan 29 2010 12:03 AM | Permanent Link |
Greg | Hi Tim, Was good to meet you in Melbourne. I cannot find a way to simulate the Transact-SQL ISNUMERIC function. This is Ok and returns 123 ... SELECT CAST('123' AS integer) FROM AnyTable However this returns an error where I had hoped it to returned 0 ... SELECT CAST('a123' AS integer) FROM AnyTable I read a post saying that DBISAM will return 0 using the same command. Hope there is a simple way. Regards Greg |
Fri, Jan 29 2010 3:49 AM | Permanent Link |
Uli Becker | Greg,
> However this returns an error where I had hoped it to returned 0 ... > SELECT CAST('a123' AS integer) FROM AnyTable You get a conversion error here and that can be expected. How about using a function named ConvertValue: BEGIN DECLARE MyResult INTEGER; BEGIN SET MyResult = CAST(Value as INTEGER); EXCEPTION SET MyResult = 0; END; RETURN MyResult; END and use it like this: select ConvertValue('a123') from mytable. Regards Uli |
Fri, Jan 29 2010 9:39 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Greg,
<< Was good to meet you in Melbourne. >> Yes, it was a pleasure to meet you and see all of the cool things that you've done with ElevateDB. << I cannot find a way to simulate the Transact-SQL ISNUMERIC function. >> The best way would be to do what Uli suggested - a custom function that simply tries the CAST() and then eats any exceptions if the value isn't a number. I'll add an enhancement request for a native function, also. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |