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 |
lrstndm
Starting Member
1 Post |
Posted - 2012-06-12 : 03:05:25
|
Hi all,I have a problem with a stored procedure i want to create.I want to create a search query for a table, but i don't know how to do it.you can search in this table on multiple colloms.myTable:IDNameNicknamePhoneNumber |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-06-12 : 06:50:34
|
The stored proc you create would have the parameters that you want to search by and use those parameters in the WHERE clause of your query. If some of those parameters can be null - for example, if you want to search someone just by their phone number, you would send only the phone number and the rest of the parameters as null.Take a look at Gail Shaw's blog here - she has an example that is both simple and efficient: http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/ |
 |
|
|
|
|