Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 handle first digit a to z

Author  Topic 

usafelix
Posting Yak Master

165 Posts

Posted - 2014-08-12 : 10:04:00
Please give a query statement to filter only to handle first digit within 1,2,3,4,5,6,7,8,9 their item number and not process the first digit include a-z. ?

item number qty amount
1222AX 22 $1
233be 10 $2
3x3ba 20 $3
a12345 3 $100
x34342 4 $200
yb2334 5 $300

total 52 $ 6


gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-08-12 : 10:25:30
select ...
where left([item number],1) like '[1-9]'
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-08-12 : 13:05:13
WHERE Item LIKE '[1-9]%'



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
   

- Advertisement -