gpt4 book ai didi

SQL Server ISNUMERIC 返回错误数据

转载 作者:行者123 更新时间:2023-12-04 14:37:35 24 4
gpt4 key购买 nike

我正在使用 SQL Server 2008 R2。当我执行以下查询时,ISNUMERIC 的计算结果为 true(1),而条码内部显然有“D”。

 SELECT ISNUMERIC('7210300106D30')

如果我用 D 或 E 以外的其他字母执行相同的代码,它似乎评估为 false(0),这正是我所期望的。
 SELECT ISNUMERIC('7210300106K30')

谁能解释一下为什么会发生这种情况?谢谢。

最佳答案

编辑

我最初的答案是错误的,这是因为 e 在科学记数法中用于分配指数,而 D 显然也用于表示数字格式。

10e3

Do notice that "e" and "d" (everybody forgets about this) are not included as numeric in the results because a single "e" or "d is NOT considered to be numeric. HOWEVER, these letters represent two different forms of numeric notation (the one with the "e" is Scientific Notation). So, if you have anything that looks like the following, ISNUMERIC will identify them as "Numeric"...

SELECT ISNUMERIC('0d2345') SELECT ISNUMERIC('12e34')



http://www.sqlservercentral.com/articles/ISNUMERIC()/71512/

它可能会将其视为十六进制数,即数字序列中的任何内容:
0123456789ABCDEF

Hexadecimal describes a base-16 number system. That is, it describes a numbering system containing 16 sequential numbers as base units (including 0) before adding a new position for the next number. (Note that we're using "16" here as a decimal number to explain a number that would be "10" in hexadecimal.) The hexadecimal numbers are 0-9 and then use the letters A-F.
http://whatis.techtarget.com/definition/hexadecimal

关于SQL Server ISNUMERIC 返回错误数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42787933/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com