Insert query

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

Insert query

От:
Paulo Trezentos <Paulo.Trezentos@iscte.pt>
Дата:
Dear Mr. Reader

I would like to insert a tuple in a table. The problem is that one of my
fields as a "  '  ".

The query is like this :

INSERT INTO mytable VALUES ('field1','fiel  ' d2');

Is this a bug, or is there another way of inserting that tuple ?

                                            Thanks for reading this

                                               Joao Campanico

Re: [SQL] Insert query

От:
Holger Mitterwald <mittehlg@coi.de>
Дата:
On Tue, 14 Jul 1998, Paulo Trezentos wrote:

> Dear Mr. Reader
> 
> I would like to insert a tuple in a table. The problem is that one of my
> fields as a "  '  ".
> 
> The query is like this :
> 
> INSERT INTO mytable VALUES ('field1','fiel  ' d2');
> 
> Is this a bug, or is there another way of inserting that tuple ?

psql for example expects a 6th "'" as end for the string. And it is
completely confused by the result :-)

To insert your obscure tuple, you have to 'escape' the "'". 
Just try:

INSERT INTO mytable VALUES ('field1','fiel  \' d2');
                                            ^^
the "'" is not interpreted as part of the sql-command but interpreted as
part of the string.

So long,
        Holger


FAQ