Solved

inserting single quotes in varchar

Posted on 2001-07-06
4
492 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I guess that all of us know that caching the data usually increase the performance, but I worried if all of us are aware about the risk that caching the data provides and how to minimize this.  That’s the reason why I decided to write this short art…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now