1

I have a field that is varchar(100) - if the field is all text, I want to ignore it, if it is alpha-numeric I want to return the data. This is sample DDL and my ISNUMERIC() excludes both values (I assume because they contain text with the numbers).

How should this be altered in order to return any value that is not just text?

Declare @Table Table (field1 varchar(100))
Insert Into @Table Values 
('1ZCLJKSDFLKSJDF'), 
('0301190XFS3'), 
('Pink Socks Run Free'), 
('White Goats Stink')

Select * from @table where ISNUMERIC(field1) >= 1
4

Fairly simple:

Select * from @table where field1 LIKE '%[0-9]%'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.