I need to get only those rows which has more than 4 characters after space

I was able to get the rows which has space but not sure how to get the columns which has four or more characters after space.

SELECT LAST_NAME
FROM CUSTOMER
WHERE (RECORD_TYPE = 'i') AND (CUSTOMER_STATUS_CODE = 'ACTIVE')
AND (LAST_NAME LIKE '% %') AND (NOT (NAME_CREDENTIALS IS NULL))

In above image, After space there are rows has more than 4 characters after space. I need to get only those rows which has more than 4 characters after space.

Try:
(LAST_NAME LIKE '% %[^ ][^ ][^ ][^ ]%')

1 Like

try

len(LAST_NAME ) -charindex(' ',LAST_NAME ) = 4

1 Like

Thank you Scott

What if I want to get 4 or less characters after space.

If you want at least one non-space, then do this:

(LAST_NAME LIKE '% %[^ ]%')

1 Like