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 |
|
tiwas
Starting Member
37 Posts |
Posted - 2011-12-18 : 12:49:27
|
| Hi guys,I need to create a search sproc. Let's say it's a people database and the user can search for anything they'd like out of first name, last name, address 1, address 2, cityThen I'd have something likenvarchar(max) firstname = null,bit firname_exact = 0,nvarchar(max) lastname = null,bit lastname_exact = 0,nvarchar(max) address1 = null,nvarchar(max) address2 = null,nvarchar(max) city = nullNow, the select would proably be something likeselect * from peoplewhere...and this is the hard part. I guess I need to use a case statement in the where clause, but as not all of these are patials and the user can select to check only exact matches or partial matches for some of the fields, I was wondering if I can use 'like' for both exact and partial matches. Will this add overhead to the sproc? Are there any built-in functions for doing this?Cheers! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-18 : 12:55:10
|
| you can use like for both exact and partial matches but performance using LIKE would be obviously below =------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
|
|
|
|
|
|
|