------------------------------------ -- Author: flystone -- Version:V1.001 -- Date:2010-02-06 18:02:34 -------------------------------------- Test Data: ta If object_id('ta') is not null Drop table ta Go Create table ta(weight varchar(10)) Go Insert into ta select '1.1' union all select '1g' union all select '2' union all select '3' union all select '0.2' Go --Start Select * from ta where weight not like '%[a-z]%' and cast(weight as numeric(12,2)) > 1 --Result: /*weight ---------- 1.1 2 3(所影响的行数为 3 行) */ --End
-- Author: flystone
-- Version:V1.001
-- Date:2010-02-06 18:02:34
-------------------------------------- Test Data: ta
If object_id('ta') is not null
Drop table ta
Go
Create table ta(weight varchar(10))
Go
Insert into ta
select '1.1' union all
select '1g' union all
select '2' union all
select '3' union all
select '0.2'
Go
--Start
Select * from ta where weight not like '%[a-z]%' and cast(weight as numeric(12,2)) > 1
--Result:
/*weight
----------
1.1
2
3(所影响的行数为 3 行)
*/
--End