在SQL Server中将varchar转换为bigint时发生转换错误
问题描述:
HI,
select ISNUMERIC('149972,')
out put:
1
select ISNUMERIC('149972=')
out put:
0
在这里先出来显示1,然后再出来显示0
是吗,是否也包含在int中
谢谢
ramesh.m
here in first out put it show 1 and second out put it show 0
is it , is also include in int or not
Thanks
ramesh.m
答
根据MSDN上的定义:当输入表达式计算为有效数值数据类型时,ISNUMERIC返回1.有效数值数据类型包括以下内容:
int,数值,bigint,货币,smallint,smallmoney,tinyint,浮点数,十进制,实数"
Money中允许使用逗号,因此它返回1.如果在输入中加上+,-£等,它也会返回1.
http://msdn.microsoft.com/en-us/library/ms186272.aspx [ ^ ]
希望能有所帮助.如果是这样,请将其标记为答案/赞.
谢谢
Milind
According to definition on MSDN: "ISNUMERIC returns 1 when the input expression evaluates to a valid numeric data type. Valid numeric data types include the following:
int, numeric, bigint, money, smallint, smallmoney, tinyint, float, decimal, real"
Comma is allowed in Money, hence it is returning 1. It will also return 1 if you +, - £ etc signs in the input.
http://msdn.microsoft.com/en-us/library/ms186272.aspx[^]
Hope that helps. If it does, mark it as answer/upvote.
Thanks
Milind
报价:http://msdn.microsoft.com/en-us/library/ms186272.aspx [当输入表达式的计算结果为有效的数值数据类型时,ISNUMERIC返回1;否则返回0.
ISNUMERIC returns 1 when the input expression evaluates to a valid numeric data type; otherwise it returns 0.
表达式中的"="使其成为无效的数字.
The ''='' in the expression makes it a invalid numeric.
查看更多