当前位置: 代码迷 >> Sql Server >> isnumeric函数有关问题
  详细解决方案

isnumeric函数有关问题

热度:34   发布时间:2016-04-27 17:02:21.0
isnumeric函数问题
SELECT   isnumeric( '- ')
SELECT   isnumeric( '. ')
SELECT   isnumeric( ', ')
返回的是   1
我以前碰到这样的情况,拷得我多了很多的麻烦!
不知道还有没有别的函数可以判别这样为0,或有别的方法可以实现?????

------解决方案--------------------
配合 like 做检查就可以了.
------解决方案--------------------
select patindex( '%[0-9]% ', col)
from
(
select col= '- '
union all select '. '
union all select ', '
union all select '2 '
)tmp

--result
-----------
0
0
0
1

(4 row(s) affected)