var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: ' in a sql statement
I have the following statement:
insert into User.Ausschnitt values ('O'reilly','2','3','4','5','6');
And I get the message that there is a problem with the '
But how can I solve this problem? I looked for escape signs for the DB2, but I found nothing till now.
Can you help?
Thanks in advance,
As dbamota suggested - double apostrophes are the escape character. Apostrophes in fields can cause all sorts of problems - so you must either remove them or make sure you replace all singles withing the field value with (
EDIT: two single quotes in succession). It is your decision on whether to drop them completely or replace with ( EDIT: two single quotes in succession) for every insert (perhaps this depends on your front end?).
Last edited by gvee; 06-05-07 at
george, don't say "replace with doubles"
say "replace with two single quotes in succession"
can you see why?
Mais oui - my apologies.
There is a very big difference.
Rudy is quite correct
Thanks a lot for all your support.
I just implemented it the code. I replace a ' by ''!
But now it's shown like this in the respective field in the database.
Is there no possibility to import the string like it looks orginial, e.g. O'Reilly?
Because now I have O''Reilly in the field.
What happens when you use a SELECT statement to pick out this record?
chris, did you see post #4 and the EDITs in post #3?
@georgev: I get O''Reilly
@r937: I have seen the edits and I used two single quotes in succession
are you escaping your sql somehow, like the way the php programmers do?
NO! But I'm looking for something like that. E.g. I found an escape function for mysql but not for the DB2. Thats my problem!
My code is written in PHP!
well, i don't do php, but i've helped an awful lot of php programmers who get into trouble with sql
you (or your php code) must be doing something to escape each single quote
perhaps you could start a new thread in the php forum?