1

I'm using PostgreSQL and I searched a few codes but nothing is working for me:

select nick 
from tb_player 
where nick NOT LIKE '%[^0-9]%'

But it returns pretty much everything with or without numbers. I need to select how much nicks are just made of numbers.

The column is character varying(50).

Any tips?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sheepssj
  • 31
  • 1
  • 4
    Possible duplicate of [isnumeric() with PostgreSQL](http://stackoverflow.com/questions/16195986/isnumeric-with-postgresql) – JohnHC Dec 08 '16 at 11:42

1 Answers1

1

You can use regular expressions:

where nick ~ '^[0-9]+$'
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786