开发者

Getting around the lack of IsNumeric() function in SQL CE?

开发者 https://www.devze.com 2023-01-14 08:02 出处:网络
SQL Server 开发者_StackOverflow社区CE (3.5) doesn\'t appear to support the IsNumeric function.What are some alternatives to achieve the same functionality?Specifically, how would you test whether a CA

SQL Server 开发者_StackOverflow社区CE (3.5) doesn't appear to support the IsNumeric function. What are some alternatives to achieve the same functionality? Specifically, how would you test whether a CAST from a string to a DECIMAL datatype will succeed in SQLCE without IsNumeric?


One possibility is to explicitly add an ISNUMERIC column to the table, and set the value (in your code, using your own method or a built-in .NET method) whenever the row is added or updated.

Another possibility is to use a query like this:

SELECT * FROM tbl WHERE col LIKE '%[^0-9]%'
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号