存储过程中,怎么检测一个值是否数字 @A变量是nvarchar型的,我用Isnumeric(@A)来检测变量中的内容是否是纯数字,但是如果@A中的内容为数字后面带字母的形式,如'2bb',用Isnumeric返回的也是1,这种情况怎么解决??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 怎么可能我这里测试declare @a varchar(100)set @a='2bb'select isnumeric(@a)结果 ----------- 0(所影响的行数为 1 行) 哦,declare @i nvarchar-----后面忘了指定大小了 ^_^但是又有一个差不多的问题,如下代码: declare @Table table ( MobilePhone varchar(20) )declare @a intinsert @Table (MobilePhone) values ('1.31123E+13')select * from @Table where isnumeric(MobilePhone)=1这里的返回是有值的,象这种现象要怎么解决呢?? declare @Table table (MobilePhone varchar(20))declare @a intinsert @Table (MobilePhone) values ('1.31123E+13')insert @Table (MobilePhone) values ('13222')select * from @Table where MobilePhone not like '%[^0-9]%'------------结果:MobilePhone13222 请问like '%[^0-9]%'是什么意思 [^] 不属于指定范围 ([a-f]) 或集合 ([abcdef]) 的任何单个字符。 WHERE au_lname LIKE 'de[^l]%' 将查找以 de 开始且其后的字母不为 l 的所有作者的姓氏 这个又是怎么回事?将 varchar 值 '.362' 转换为数据类型为 int 的列时发生语法错误。 这样的字段要怎么做 Index 马上结贴~! 字符型字段的大小放到最大,有什么不好? 面试题目,小绵羊过来看一下。 SQL中存储过程生成序号问题 向表中插入一日期字段,求sql语句 怎样用命令或程序附加数据库 重装MSSQL 2k sp4数据库系统...恢复数据库...集思广益了.... 如何控制每次只select若干行? SQL Server有病 用SQL2000的导入AS\400 上DB2(v5r3) 的数据 用SQL如何展開數據集??
我这里测试
declare @a varchar(100)
set @a='2bb'
select isnumeric(@a)
结果
-----------
0(所影响的行数为 1 行)
declare @Table table (
MobilePhone varchar(20)
)
declare @a intinsert @Table (MobilePhone) values ('1.31123E+13')select * from @Table where isnumeric(MobilePhone)=1
这里的返回是有值的,象这种现象要怎么解决呢??
MobilePhone varchar(20)
)
declare @a intinsert @Table (MobilePhone) values ('1.31123E+13')insert @Table (MobilePhone) values ('13222')select * from @Table where MobilePhone not like '%[^0-9]%'
------------
结果:
MobilePhone
13222
将 varchar 值 '.362' 转换为数据类型为 int 的列时发生语法错误。