Solved

inserting single quotes in varchar

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
business objects to connect to MSSQL 6 84
Coldusion - DATA insert syntax problem 12 49
ORA-02288: invalid OPEN mode 2 56
A beginner asks: Which macos postgreSQL client? 5 41
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…

792 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