SQL BUG?

hedaoqun 2014-09-03 10:16:49

select isnumeric('04D53') as value 返回值居然是 1 ,字符串'04D53'算数值?
...全文
422 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
isnumeric函数有很多问题,比如小数点:isnumeric('.') 为1
sqlkxr 2014-09-12
  • 打赏
  • 举报
回复
如果用这个你对isnumeric加深了印象,那么你成功了
Tiger_Zhao 2014-09-03
  • 打赏
  • 举报
回复
引用 3 楼 u010024618 的回复:
[quote=引用 2 楼 Tiger_Zhao 的回复:] 科学记数法,ISNUMBERIC() 中 D 和 E 是等价的。
select convert(float ,'04D53')
                      
----------------------
                 4E+53
Actually, D stands for Decimal, E stands for Exponent(equally power of 10)[/quote] 在 SQL Server 中没区别: 没转换前,字符串就是字符串。 转换后,指定结果是什么类型就是什么类型(real/float)。
freecodex 2014-09-03
  • 打赏
  • 举报
回复
引用 2 楼 Tiger_Zhao 的回复:
科学记数法,ISNUMBERIC() 中 D 和 E 是等价的。
select convert(float ,'04D53')
                      
----------------------
                 4E+53
Actually, D stands for Decimal, E stands for Exponent(equally power of 10)
Tiger_Zhao 2014-09-03
  • 打赏
  • 举报
回复
科学记数法,ISNUMBERIC() 中 D 和 E 是等价的。
select convert(float ,'04D53')

                      
----------------------
4E+53
freecodex 2014-09-03
  • 打赏
  • 举报
回复
'04D53'能够被转换为4,这里D代表十进制 另外几个例子:‘11E2’ 能够被转换为1100,这里E代表指数 ‘$1234’ 能够被转换为1234,$这里代表钱 ISNUMERIC returns 1 when the input expression evaluates to a valid integer, floating point number, money or decimal type; otherwise it returns 0. A return value of 1 indicates that expression can be converted to at least one of the numeric types.
道素 2014-09-03
  • 打赏
  • 举报
回复
不知你的目的是什么,如果是检查字段值中都是数字过小数点,可以在调用IsNumberic前用replace将D和E换成别的字符
		SELECT ISNUMERIC (replace(REPLACE('22d45','D','C'),'E','C'))

22,206

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧