Results 1 to 4 of 4

Thread: Help with Insert into

  1. #1
    Join Date
    Feb 2005
    Posts
    2

    Help with Insert into

    My problem that I got is that I want data with a special character inserted into my database. The character what I'm talking about is this one: '. But as you can gess it gives an error. What should I do?
    I tried it with [] but that didn't work.
    help me please.

  2. #2
    Join Date
    Dec 2004
    Posts
    502
    You need to put another single quote next to any single quote that you want to insert. For example, if you want to insert the word: can't, use this syntax:

    INSERT INTO YourTable VALUES('can''t')

    As another example, if you want to insert a word and include the single quotes around it, like: 'hello', then use this:

    INSERT INTO YourTable VALUES('''hello''')

    Rule of thumb: in any SQL statement, you need to have an even number of single quotes in the statement.

  3. #3
    Join Date
    Feb 2003
    Posts
    1,048
    Whenever I insert or select end-user free form text, I always use the replace function. Replace 1 single quote with two for the insert and 2 single quotes with 1 for the select.

  4. #4
    Join Date
    Feb 2005
    Posts
    2
    thanks guy's this helped me alot.
    now my site will run smoothly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •