Validating a numeric value in the + SQL Server field

What will be the most efficient way to check the numbers in a field that will contain several letters? I would like to do this if a where clause is possible.

The data looks something like this:

3833N4323 32N907654 5W5840904

+3
source share
3 answers

Checking at least one number in a field (fixed):

WHERE PATINDEX('%[0-9]%', field) != 0

Checking only the numbers in the field:

WHERE ISNUMERIC(field) = 1
+12
source

A simple LIKE to find any number would be enough ...

...WHERE LIKE '%[0-9]%'
+6
source
select ISNUMERIC(data)
+1
source

Source: https://habr.com/ru/post/1728106/


All Articles