Link to home
Start Free TrialLog in
Avatar of kapil009
kapil009

asked on

inserting single quotes in varchar

Hi friends.

How to insert the a Single Quotes (') in a varchar data field.
If i give query like as following

 insert into table1 values( 'test'test' , 1212,'hai');

There are 3 fields fl1,fl2  fl3.

fl1 value = "test'test"

but i dont how to insert this value

Any one can help me?

waiting for reply
Kapil


ASKER CERTIFIED SOLUTION
Avatar of renuraj
renuraj

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ser6398
ser6398

What kind of database?

One possible way is to use the ASCII function of whatever database you are using.  In Oracle, you could do something like:

select chr(39)||'bob'||chr(39)
from dual;

You get the same result as:

select '''bob'''
from dual;

To be clear

insert into table1 values( 'test'||''''||'test', 1212,'hai');

All are single quotes...

Regards,
Avatar of kapil009

ASKER

Hi ser6398 & renuraj

Thanx

insert into table1 values( 'test'||''''||'test', 1212,'hai');
This statement is working...

I am using DB2...

Bye
Kapil...