[GENERAL] spring a string to rows (Postgresql 8.4)

2013-01-07 Thread Emi Lu
Hello, Is there a function to split a string to different rows? For example, t1(id, col1) values(1, 'a, b, c'); select id, string_split_to_row(col1, ','); Return: = 1, a 1, b 1, c Thanks alot! Emi -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] spring a string to rows (Postgresql 8.4)

2013-01-07 Thread Raymond O'Donnell
On 07/01/2013 19:44, Emi Lu wrote: Hello, Is there a function to split a string to different rows? For example, t1(id, col1) values(1, 'a, b, c'); regexp_split_to_table() should do it: http://www.postgresql.org/docs/8.4/static/functions-string.html HTH Ray. -- Raymond O'Donnell ::

Re: [GENERAL] spring a string to rows (Postgresql 8.4)

2013-01-07 Thread Thomas Kellerer
Emi Lu wrote on 07.01.2013 20:44: Hello, Is there a function to split a string to different rows? For example, t1(id, col1) values(1, 'a, b, c'); select id, string_split_to_row(col1, ','); Return: = 1, a 1, b 1, c Thanks alot! Emi select id, regexp_split_to_table(col1, ',')

Re: [GENERAL] spring a string to rows (Postgresql 8.4)

2013-01-07 Thread Moshe Jacobson
select id, unnest(regexp_split_to_array(col1, ',\s+')) On Mon, Jan 7, 2013 at 2:44 PM, Emi Lu em...@encs.concordia.ca wrote: Hello, Is there a function to split a string to different rows? For example, t1(id, col1) values(1, 'a, b, c'); select id, string_split_to_row(col1, ',');