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 |
|
dhinasql
Posting Yak Master
195 Posts |
Posted - 2008-03-10 : 02:59:12
|
| Hi friends,I have a table named as Users, i have three column username,email ID,address.When the user search for user details they can give the user name as blank or email as a blank, but user should enter atleast one field, i want to use the like operator for both username and email... what i have to do plss help me |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-03-10 : 03:03:23
|
[code]SELECT *FROM UsersWHERE ( @username IS NULL OR username LIKE '%' + @username + '%' )AND ( @emailid IS NULL OR emailid LIKE '%' + @emailid + '%' )[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|