Thread: how to put an special code in a string

how to put an special code in a string

From
"jack"
Date:
Hi all,

With pg/Sql, how do I put an special code in a string? Such as

''abc'' || <tab>||''xxx''||<cr/lf>

How do I specify a tab or cr/lf code? Thank you

Jack



Re: how to put an special code in a string

From
Tomasz Myrta
Date:
Uz.ytkownik jack napisa?:
> Hi all,
>
> With pg/Sql, how do I put an special code in a string? Such as
>
> ''abc'' || <tab>||''xxx''||<cr/lf>
>
> How do I specify a tab or cr/lf code? Thank you
C style should work. Try
<tab> -> \t
<cr/lf> -> \r\n ?
Regards,
Tomasz Myrta



Re: how to put an special code in a string

From
Jeff Eckermann
Date:
--- Tomasz Myrta <jasiek@klaster.net> wrote:
> Uz.ytkownik jack napisa?:
> > Hi all,
> > 
> > With pg/Sql, how do I put an special code in a
> string? Such as
> > 
> > ''abc'' || <tab>||''xxx''||<cr/lf>
> > 
> > How do I specify a tab or cr/lf code? Thank you
> C style should work. Try
> <tab> -> \t
> <cr/lf> -> \r\n ?

A generalized solution is to use the chr() function,
which can represent any ascii character, given the
decimal value as an argument.
So, <tab> is chr(9); <cr/lf> is chr(13) || chr(10)

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com