sql server - Selecting positive numbers from char column -
i have table char column , want positive numbers it.
declare @tabela table (id varchar(20)) insert @tabela values ('-12'),('10'),('25'),('12a') i tried obvious queries like:
select * @tabela id > 0 , isnumeric(id) = 1 and
select * (select * @tabela isnumeric(id) = 1) id > 0 and
;with (select * @tabela isnumeric(id) = 1) select * id > 0 but don´t work , returns error:
conversion failed when converting varchar value '12a' data type int
the following 1 worked, afraid not guaranteed work in situation, since can´t guarantee order of evaluation of clause:
select * @tabela isnumeric(id) = 1 , id > 0 and other option thought pretty ugly:
select * ( select case when isnumeric(id) = 1 case when id > 0 id end end id @tabela ) id not null is there way positive numbers in 1 query?
Comments
Post a Comment