[EMAIL PROTECTED] <[EMAIL PROTECTED]> schrieb: > Hi, > > I have a varchar column, and I need to > > 1) check the value in it is an integer > 2) get the integer value (as integer) > > The problem is I can't suppose the're only correct > values - ie there can be something like 'xssdkjsd', > '230kdd' or even an empty string etc.
test=# select * from foo; t | n ------+--- bla | bla1 | 2 | (3 rows) test=# update foo set n = substring(t , '[0-9]')::int; UPDATE 3 test=# select * from foo; t | n ------+--- bla | bla1 | 1 2 | 2 (3 rows) Regards, Andreas -- Diese Message wurde erstellt mit freundlicher Unterstützung eines freilau- fenden Pinguins aus artgerechter Freilandhaltung. Er ist garantiert frei von Micro$oft'schen Viren. (#97922 http://counter.li.org) GPG 7F4584DA Was, Sie wissen nicht, wo Kaufbach ist? Hier: N 51.05082°, E 13.56889° ;-) ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster