Solved

inserting single quotes in varchar

Posted on 2001-07-06
4
517 Views
Last Modified: 2012-06-27
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


0
Comment
Question by:kapil009
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
renuraj earned 50 total points
ID: 6259824
Hi kapil..

Try this out

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

Regards,




0
 
LVL 5

Expert Comment

by:ser6398
ID: 6259828
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;

0
 
LVL 2

Expert Comment

by:renuraj
ID: 6259836
To be clear

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

All are single quotes...

Regards,
0
 

Author Comment

by:kapil009
ID: 6259878
Hi ser6398 & renuraj

Thanx

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

I am using DB2...

Bye
Kapil...


0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes some very basic things about SQL Server filegroups.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question