By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,691 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,691 IT Pros & Developers. It's quick & easy.

Select Non Alpha Contents of a Column

P: n/a
Is there a way to select all rows where a certain column starts with
non-alpha characters?

I would like to select all the rows that don't start with letters.

Possible?

Hunter
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

--- Hunter Hillegas <li***@lastonepicked.com> wrote:
Is there a way to select all rows where a certain
column starts with
non-alpha characters?

I would like to select all the rows that don't start
with letters.

Possible?


Regular expressions would do what you want, e.g.
"select * from mytable where myfield !~ '^[a-zA-Z]';"
Look under "pattern matching" in the "functions and
operators" section of the manual (I think, working
from memory).

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #2

P: n/a
El Lun 29 Dic 2003 20:11, Hunter Hillegas escribió:
Is there a way to select all rows where a certain column starts with
non-alpha characters?

I would like to select all the rows that don't start with letters.

Possible?


SELECT * FROM table_name WHERE col !~* '^a-z'

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.