Escape Characters

  • I am trying to run a following query

    select * from employeedetails where edescription='employee name is 'john jackson' and state is 'ca''

    its throwing an error because of the (') in where clause...

    Can anyone suggest how I can rectify this query???

    Thanks

    Joel


    Kindest Regards,

    Joel

  • If you want to parse in single-quotes, use two of them in your string:

    select * from employeedetails where edescription='employee name is ''john jackson'' and state is ''ca'''

  • try this

    select * from employeedetails where edescription='employee name is ''john jackson'' and state is ''ca'''

  • add another ' for every '

    select * from employeedetails

    where edescription='employee name is ''john jackson'' and state is ''ca'''

  • Thank-you Guys for the help...I appended every ' with another '....

    That worked


    Kindest Regards,

    Joel

  • They are covered under quoted identifiers and delimiters in ANSI SQL 1992.  Try the link below for details from Microsoft.  Hope this helps.

    http://msdn2.microsoft.com/en-us/library/ms176027.aspx

    Kind regards,
    Gift Peddie

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply