更新时间:2023-11-26 08:35:28
你可以使用PATINDEX:
You can use PATINDEX:
select PATINDEX('%[^0-9,]%', '822632,822633,822634,822635,827402,827403,827404,827405') -- 0
Select PATINDEX('%[^0-9,]%', '822632,822633') --0
Select PATINDEX('%[^0-9,]%', '8226326125163143146341') --0
Select PATINDEX('%[^0-9,]%', '822632,822633,822') -- 0
Select PATINDEX('%[^0-9,]%', '822632,822633,8243') --0
Select PATINDEX('%[^0-9,]%', '822632323232233,822633') -- 0
Select PATINDEX('%[^0-9,]%', '8226323,8226335612') --0
Select PATINDEX('%[^0-9,]%', '822632,a822633') --8
Select PATINDEX('%[^0-9,]%', 'a822632,a822633') --1
模式[0-9,]查找1到9中的任何一个或逗号,[^ 0-9,]查找其他所有内容。如果找到任何其他字符,它将返回索引> 0,否则为零
The pattern [0-9,] looks for any of 1 to 9 or comma, [^0-9,] looks for everything else. If it finds any other char it will return index>0, otherwise zero
您可以先尝试替换逗号,然后再执行ISNUMERIC。
这样的东西:
You could try and replace the comma first and then do ISNUMERIC.
Something like this:
select ISNUMERIC(replace('8226323,8226335612',',','')) AmINumeric
不确定它是否适用于真正非常大的数字。
Not sure if it will work on really really very large numbers though.