Обсуждение: Problem with apostrophe
Is there any way of having an apostrophe in a data field? It is a problem because the apostrophe is the same character as the single quote, so the database gets a parser error when a name such as "O'Brian" is entered. There must be a work-around, but I can not find any solution. thank you for your help
On Wed, 17 Jun 1998 eric@gateway.ctlno.com wrote: > Is there any way of having an apostrophe in a data field? > It is a problem because the apostrophe is the same character as the single > quote, so the database gets a parser error when a name such as "O'Brian" > is entered. Have you tried doubling up? 'O''Brian' That is what I have to do in Oracle anyway. -- Amos Hayes Systems Architect ahayes@ingenia.com Ingenia Group - Software Kinetics Ltd. http://smurf.ingenia.com/~ahayes http://www.ingenia.com "Remember: No one can make you feel inferior without your consent." - ELEANOR ROOSEVELT
On Wed, 17 Jun 1998, Amos Hayes wrote: > > Is there any way of having an apostrophe in a data field? > > It is a problem because the apostrophe is the same character as the single > > quote, so the database gets a parser error when a name such as "O'Brian" > > is entered. > > Have you tried doubling up? 'O''Brian' > > That is what I have to do in Oracle anyway. Isn't there an escape character, like the slash? Brett W. McCoy http://www.lan2wan.com/~bmccoy ----------------------------------------------------------------------- "The Number of UNIX installations has grown to 10, with more expected." -- The UNIX Programmer's Manual, 2nd Edition, June, 1972
the escape character brings up the help menu, thinking that \' is not a valid option. On Wed, 17 Jun 1998, Brett W. McCoy wrote: > On Wed, 17 Jun 1998, Amos Hayes wrote: > > > > Is there any way of having an apostrophe in a data field? > > > It is a problem because the apostrophe is the same character as the single > > > quote, so the database gets a parser error when a name such as "O'Brian" > > > is entered. > > > > Have you tried doubling up? 'O''Brian' > > > > That is what I have to do in Oracle anyway. > > Isn't there an escape character, like the slash? > > Brett W. McCoy > http://www.lan2wan.com/~bmccoy > ----------------------------------------------------------------------- > "The Number of UNIX installations has grown to 10, with more expected." > -- The UNIX Programmer's Manual, 2nd Edition, June, 1972 >
Just escape the apostrophe with a backslash. Byron eric@gateway.ctlno.com wrote: > Is there any way of having an apostrophe in a data field? > It is a problem because the apostrophe is the same character as the single > quote, so the database gets a parser error when a name such as "O'Brian" > is entered. > > There must be a work-around, but I can not find any solution. > > thank you for your help
eric@gateway.ctlno.com writes: > the escape character brings up the help menu, thinking that \' is not a > valid option. No. Entering something like SELECT * FROM foo WHERE name=�O\�Brian�; definitely works. Ciao Christoph -- ** http://ourworld.compuserve.com/homepages/ChLorenz/ ** ChLorenz@csi.com ** ** No Spam ! ** No Adverts ! ** No Junk-Mails ! ** No unwanted Mails ! **
On Wed, 17 Jun 1998 eric@gateway.ctlno.com wrote: > Is there any way of having an apostrophe in a data field? > It is a problem because the apostrophe is the same character as the single > quote, so the database gets a parser error when a name such as "O'Brian" > is entered. > > There must be a work-around, but I can not find any solution. > > thank you for your help You may use doubble apostrophe as in O''Brian to match O'Brian this is SQL92. Jose' | | ~~~~~~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~~~~~~~~ Progetto HYGEA ---- ---- www.sferacarta.com Sfera Carta Software ---- ---- sferac@bo.nettuno.it Via Bazzanese, 69 | | Fax. ++39 51 6131537 Casalecchio R.(BO) Italy | | Tel. ++39 51 591054 -----------------------------------------------------------------------------