Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cheesecake
Starting Member
11 Posts |
Posted - 2010-08-06 : 18:02:57
|
| Hi,I have a table Test and it has a column length. I want to find the records that have a single quote i.e. 8' or 9' in the column "length"etc.i am using like operator but don't know what should i search for?Please help.Thanks,CheeseCake |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-08-07 : 02:12:44
|
| [code]SELECT * FROM MyTestTable WHERE MyLengthColumn LIKE '%''%'[/code] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-08-07 : 02:14:18
|
[code]WHERE charindex( '''', MyLengthColumn) <> 0[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-08-07 : 03:00:32
|
| Do you have a preference? (performance-wise etc.) or just personal taste? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-08-07 : 03:12:09
|
me ?Performance wise, both should be the same as it will cause a scan.Personal taste, i would use the LIKE, just in case, one day somebody decide to remove the pre "%". KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-08-07 : 05:51:38
|
| Yeah, me too. Just wondered if I was missing a trick. Ta. |
 |
|
|
|
|
|