How to Find Greater Than of an Alphanumeric Number


Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Exchange

Q&A for meta-discussion of the Stack Exchange family of Q&A websites

declare @tbl as table(SalesOrderNo varchar(10));
insert into @tbl values
('D 20'),
('D 21');

select SalesOrderNo from @tbl
where SalesOrderNo LIKE 'D%'
and cast(right(SalesOrderNo, len(SalesOrderNo) - 1) as int) > 16;

Enter Parameters

Switch sites
loading Hold tight while we fetch your results