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 |
|
Ivan Andrade
Starting Member
2 Posts |
Posted - 2005-09-15 : 18:17:51
|
| Hi,I've tried that but it does not work:SELECT Field FROM Table WHERE Field LIKE @parameterthanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-09-15 : 18:26:59
|
| SELECT Field FROM Table WHERE Field LIKE @parameter + '%'Tara |
 |
|
|
Ivan Andrade
Starting Member
2 Posts |
Posted - 2005-09-15 : 18:36:33
|
| It did not work :( |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-09-15 : 18:39:18
|
| Well it depends what you want to do. My solution is for performance. It is not a good idea to put a wild card first. For performance reasons, you should only use the starts with, which is what I provided. That's being a good DBA. Now some other DBA might allow this:SELECT Field FROM Table WHERE Field LIKE '%' + @parameter + '%'Take a look at the difference.Tara |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-09-15 : 22:54:22
|
| what does field contain? what does @parameter contain?read patindex, charindex and like in BOL to determine your best option--------------------keeping it simple... |
 |
|
|
|
|
|