March 11, 2005 at 8:58 am
I have a rather large table (we'll call it Shows) where one of the columns (we'll call it SHOW_NAME) has entries that contain both single and double quotes like this:
"This is the show's name"
I'm trying to select out these entires and doing:
Select * from Shows where SHOW_NAME= '"This is the show's name"'
Obvioulsy this doesn't work. How can I "Select" these from the table?????
March 11, 2005 at 9:54 am
You may probably use escape characters. See Books Online "Like" topic:
You can search for character strings that include one or more of the special wildcard characters. For example, the discounts table in the customers database may store discount values that include a percent sign (%). To search for the percent sign as a character instead of as a wildcard character, the ESCAPE keyword and escape character must be provided. For example, a sample database contains a column named comment that contains the text 30%. To search for any rows containing the string 30% anywhere in the comment column, specify a WHERE clause of WHERE comment LIKE '%30!%%' ESCAPE '!'. Unless ESCAPE and the escape character are specified, SQL Server returns any rows with the string 30.
This example shows how to search for the string "50% off when 100 or more copies are purchased" in the notes column of the titles table in the pubs database:
USE pubsGOSELECT notesFROM titlesWHERE notes LIKE '50%% off when 100 or more copies are purchased' ESCAPE '%'GO
Regards,Yelena Varsha
March 11, 2005 at 10:02 am
Awesome ! Thank you!!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply