If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Probably Very Simple

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-11-04, 11:35
baynezy baynezy is offline
Registered User
 
Join Date: Jul 2004
Location: London, England
Posts: 71
Arrow Probably Very Simple

I need to enter some data into a databse using SQL. However, how do you enter a value into a string which contains a quote?

I am using the normal INSERT statement ie
INSERT INTO table
VALUES (1, 2, 'Here's the problem', 4)
etc..

Answers on a postcard please?
__________________
Simon Baynes
www.simonbaynes.com

'The only way to discover the limits of the possible is to go beyond them into the impossible.'
Arthur C. Clarke
Reply With Quote
  #2 (permalink)  
Old 07-11-04, 12:04
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Which DBMS? For Oracle the answer is to double up embedded quotes:

INSERT INTO table
VALUES (1, 2, 'Here''s the problem', 4)

(Note that that is two 's, not one ")
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 07-11-04, 14:20
derrickleggett derrickleggett is offline
Registered User
 
Join Date: Apr 2004
Location: Kansas City, MO
Posts: 734
Same with Microsoft SQL Server
__________________
MeanOldDBA
derrickleggett@hotmail.com
When life gives you a lemon, fire the DBA.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On