Getting around the lack of IsNumeric() function in SQL CE?
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]%'
精彩评论