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 |
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2011-01-29 : 22:54:13
|
| himy table has a PartNumber field with 3 rows of data:1211 55 3 125 55451211 05 4 125 55351216 53 5 128 5435How do i use LIKE to extract exact match. For example, if a user type in 55, it should retrieve the 1st row, and if user typed in 5, then it should only retrieve the 3rd row. Thanks |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-01-30 : 01:34:29
|
| check this oneSelect Col1,col2,...,ColN from TableNameWhere ColX like '% 55 %' --note the white spaces in at first and last. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-02-06 : 21:00:24
|
quote: Originally posted by sg2255551 himy table has a PartNumber field with 3 rows of data:1211 55 3 125 55451211 05 4 125 55351216 53 5 128 5435How do i use LIKE to extract exact match. For example, if a user type in 55, it should retrieve the 1st row, and if user typed in 5, then it should only retrieve the 3rd row. Thanks
Are you searching specifically on the 6th & 7th char only ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2011-02-07 : 07:53:04
|
| Thks. MIK_2008 solution works for me. |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-07 : 09:52:10
|
| yrwCheers! |
 |
|
|
|
|
|
|
|