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 |
|
mdwan
Starting Member
1 Post |
Posted - 2003-03-26 : 12:10:51
|
| Hello. I need to select rows based on several characters at the begining of a column. However, when i use "where colname like whatever%" it grabs rows that match the characters even though they occur somewhere in the middle of the string. Any suggestions on how to only match at the begining of a string? Thanks! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-03-26 : 12:23:45
|
| SELECT * FROM Table1WHERE column1 LIKE 'whatever%'The above code should only return records that start with whatever. It should not return ones that have whatever in the middle of the string. Are you putting a % before whatever (%whatever%)?Tara |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-03-26 : 13:04:26
|
| Tara's correct. Can you post you're actual query.Here's a sample that shows the difference.USE NorthwindGOSELECT * FROM Products WHERE ProductName Like 'A%'GOSELECT * FROM Products WHERE ProductName Like '%Hot%'GOBrett8-) |
 |
|
|
|
|
|