Results 1 to 6 of 6

Thread: simple string problem

  1. #1
    Join Date
    Aug 2003
    Location
    London
    Posts
    110

    Unhappy simple string problem

    hi,

    I have got a script which send emails out.

    my problem is that the person that it is trying to send the email to has got a name O'REILLY, PAULINE


    and ' is causing the problem as in



    master..xp_sendmail @recipients='O'REILLY, PAULINE',@message='This is an auto-generated message by Firmware.


    It doesn’t not recognize O'REILLY, PAULINE as a whole string


    and way around the problem?

    Many Thanks

    Shaunt

  2. #2
    Join Date
    Mar 2003
    Posts
    468
    don't know the specifics of the sendmail but usually one of the following solves the problems with quotes within a string.

    1. escape the character
    ex. 'O\'REILLY, PAULINE'
    2. use two quotes
    ex. 'O''REILLY, PAULINE'
    3. use different outer quotes
    ex. "O'REILLY, PAULINE"

    hope it helps

  3. #3
    Join Date
    Aug 2003
    Location
    London
    Posts
    110
    I have to go to the last option

    3. use different outer quotes
    ex. "O'REILLY, PAULINE"


    but as it is sql 7 it inot excepting it

  4. #4
    Join Date
    Aug 2003
    Location
    London
    Posts
    110
    this quite urgent
    please help

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    What error you get. Both option 2 and 3 should work.

    If you want to use option 3, you should run

    SET QUOTED_IDENTIFIER OFF

  6. #6
    Join Date
    Aug 2003
    Location
    London
    Posts
    110
    many thanks

    that was what I needed

    problem sorted

    cheer

Posting Permissions

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