Results 1 to 3 of 3

Thread: Quotes in SQL

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Manchester, UK
    Posts
    50

    Question

    I need to insert text into a database using SQL which has single quotes (') in - but every time I try I can't do it because it conflicts with the quotes used in the SQL command:

    INSERT INTO Table (Field) VALUES ('hello, it's a nice day')

    The quote in the word " it's " causes an error. Does anyone now how to add a quote?

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    For any SQL text field being used in a statement always use the following:
    Code:
    myFielddata = Replace(myFielddata, "'", "''")
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Manchester, UK
    Posts
    50

    Cool

    thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width