Data containt ' mark

  • Hi

    In my table I have varchar column. Data contains ' mark like Johnson's,Arun's etc.

    I want get all records that contains ' mark.

    Pls help

    Binu

  • SELECT * FROM MyTable

    WHERE MyColumn LIKE '%''%'

    John

  • hi

    Thanks. I have to update the column with a value johnson's.

    Also I want to select only records that contains ' mark.

    binu

  • The trick is to double the single quote. So when inserting, instead of just one ('), you put in two (''). If you are selecting, the same rule applies. You asked for a query to locate all rows where a given field uses the single quote, hence the reason someone came back with LIKE '%''%'

    K. Brian Kelley
    @kbriankelley

  • Hi

    I got the result. But I again I faced an issue. the column contains some values without ' mark. I need to extract these records also using a single query

    binu

  • What is the criteria for retrieving the other rows? Write it out as a simple query and then cut out the WHERE part and add it to the first query after the WHERE part with an OR operator.

    SELECT Column from Table WHERE column LIKE '%''%' OR column Operator Criteria


    Regards,

    goodguy

    Experience is a bad teacher whose exams precede its lessons

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

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