Field to textfield

Field to textfield

am 20.04.2006 09:43:45 von Wesley

Is there a way to take an entire row from a table and convert it to an
output string? I want to use the string and append it to a text file.

Thanks Wes

Re: Field to textfield

am 20.04.2006 12:44:10 von Aggro

wesley@ispace.co.za wrote:
> Is there a way to take an entire row from a table and convert it to an
> output string? I want to use the string and append it to a text file.

You can use CONCAT() function to combine values from different columns.
The result will be a single string:

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html

Re: Field to textfield

am 20.04.2006 17:40:39 von onedbguru

While the concat function is great, if you ever want to move this to a
real database engine like oracle... you can/should the ANSI standard
syntax.

select field1||','||field2||','||field3.... from tablex where ....

Re: Field to textfield

am 20.04.2006 19:56:02 von Bill Karwin

onedbguru@firstdbasource.com wrote:
> While the concat function is great, if you ever want to move this to a
> real database engine like oracle... you can/should the ANSI standard
> syntax.
>
> select field1||','||field2||','||field3.... from tablex where ....

It should be mentioned that one has to set the SQL_MODE of
PIPES_AS_CONCAT or ANSI to enable this syntax.

Using this syntax without either of those SQL_MODE values in effect is
still a legal expression. The double-pipe works like logical OR when
not running in ANSI mode. So the resulting value of the expression will
be 1, which might be confusing.

Regards,
Bill K.