T-SQL query sample for alpha-numeric characters

This sample uses higher than, less than, ISNumeric, and expresions with Varchar fields.

Declare @esn Table(id int primary key,Num varchar(11))
insert into @esn
values	(1,'123456AB'),

/*Query only Numeric*/
Select *
from @esn 
where ISNUMERIC(Num)=1
/*Query Start with a Letter*/
 Select *
 from @esn 
 where Num > 'A'
 /*End with a letter*/
 Select *
from @esn 
where right(Num,1) > '9'
/*Only Letters*/
Select *
from @esn 
where  Num  Not LIKE '%[^A-Z]%'

Comments are closed.

Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /homepages/35/d428352912/htdocs/WilliamMendoza/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048