Обсуждение: how to put an special code in a string

Поиск
Список
Период
Сортировка

how to put an special code in a string

От
"jack"
Дата:
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

От
Tomasz Myrta
Дата:
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

От
Jeff Eckermann
Дата:
--- 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