Home > Archive > SQL Anywhere database > July 2005 > apostrophes in a result set









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author apostrophes in a result set
Veselin Ivanov

2005-07-14, 11:23 am

Hi, using ASA 9.0.0.3137

create table t(
c1 char(32) null,
);

insert into t (c1) values ('Some text')

How can I select column c1 with apostrophes ?

c1
========
'Some Text'


TIA
Vesselin


Erik Anderson

2005-07-14, 11:23 am

select '''' || c1 || '''' as c1 from t ?

"Veselin Ivanov" <vs@sonita.com> wrote in message
news:42d695fc@forums
-2-dub...
> Hi, using ASA 9.0.0.3137
>
> create table t(
> c1 char(32) null,
> );
>
> insert into t (c1) values ('Some text')
>
> How can I select column c1 with apostrophes ?
>
> c1
> ========
> 'Some Text'
>
>
> TIA
> Vesselin
>



Nick Elson

2005-07-14, 1:23 pm

Either
A - insert the value with apostrophes in the first place
I.E.
insert into t (c1) values ('''Some text''')
or
insert into t (c1) values ('Some text w''apostrophes'' ')
OR

B - select it back concatinating them yourself
I.E.
select string( ''', c1, ''') as c1 from t;
or
select '''' || c1 || '''' as c1 from t;

or
select '''' +| c1 +| '''' as c1 from t;


"Veselin Ivanov" <vs@sonita.com> wrote in message
news:42d695fc@forums
-2-dub...
> Hi, using ASA 9.0.0.3137
>
> create table t(
> c1 char(32) null,
> );
>
> insert into t (c1) values ('Some text')
>
> How can I select column c1 with apostrophes ?
>
> c1
> ========
> 'Some Text'
>
>
> TIA
> Vesselin
>



Veselin Ivanov

2005-07-14, 1:23 pm

Thanks Nick and Erik,
as I tested this in Interactive SQL and it places the quote string around
string values the result was with double apostrophes.

Regards
Vesselin

"Nick Elson" < no_spam_nicelson@syb
ase.com> wrote in message
news:42d69c8a$1@foru
ms-2-dub...
> Either
> A - insert the value with apostrophes in the first place
> I.E.
> insert into t (c1) values ('''Some text''')
> or
> insert into t (c1) values ('Some text w''apostrophes'' ')
> OR
>
> B - select it back concatinating them yourself
> I.E.
> select string( ''', c1, ''') as c1 from t;
> or
> select '''' || c1 || '''' as c1 from t;
>
> or
> select '''' +| c1 +| '''' as c1 from t;
>
>
> "Veselin Ivanov" <vs@sonita.com> wrote in message
> news:42d695fc@forums
-2-dub...
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com