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 |
|
zeeshan13
Constraint Violating Yak Guru
347 Posts |
Posted - 2009-03-11 : 16:19:31
|
| I have a table called Product with a varchar field called Name. I want to select all records where Product contains % character anywhere in the string.How to write this query.Please help quickly.Thanks,Zee |
|
|
zeeshan13
Constraint Violating Yak Guru
347 Posts |
Posted - 2009-03-11 : 16:30:26
|
| Can someone help please.... |
 |
|
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2009-03-11 : 16:51:41
|
| why is there a name with % in the first place? is the field full-text indexed? if so useSELECT * FROM Product AS t WHERE CONTAINS(Name, '%')hope it is not too late, hope you passed the test |
 |
|
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2009-03-11 : 17:01:09
|
also SELECT * FROM Test AS t WHERE FieldName LIKE ( '%!%') ESCAPE '!'; and using wildcard brackets []following is best to find % anywhere in fieldSELECT * FROM Test AS t WHERE FieldName LIKE '%!%%' ESCAPE '!'; |
 |
|
|
zeeshan13
Constraint Violating Yak Guru
347 Posts |
Posted - 2009-03-11 : 18:42:58
|
| Thanks.... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-03-12 : 02:24:49
|
| orSELECT * FROM Test AS t WHERE FieldName LIKE ( '%[%]%') MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|