在SQL Server中将varchar转换为bigint时发生转换错误

编程入门 行业动态 更新时间:2024-10-25 15:27:18
本文介绍了在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. msdn.microsoft/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. msdn.microsoft/en-us/library/ms186272.aspx[^] Hope that helps. If it does, mark it as answer/upvote. Thanks Milind

报价:msdn.microsoft/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.

更多推荐

在SQL Server中将varchar转换为bigint时发生转换错误

本文发布于:2023-11-04 12:14:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557913.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   中将   错误   发生   Server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!