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 |
|
trouble2
Constraint Violating Yak Guru
267 Posts |
Posted - 2008-09-10 : 05:36:37
|
| Hi, Im building a SP where I need to either:- return all records- return all records with email address- return all records without email addressAlso the table has fields for postal address or visit address.So I need to filter:- return all records- return records with only a postal address- return records with only a visit address- return records with no addressI'm not sure what is the best way to do this.Should I use @Emailfilter varchar(20) = 'All' And then do a case statement or something....What would be smart. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-09-10 : 05:44:18
|
something like this .. where ( @Emailfilter = 'All'or ( @Emailfilter = 'Email' and EmailAddr is not null )or ( @Emailfilter = 'No Email' and EmailAddr is null )) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
trouble2
Constraint Violating Yak Guru
267 Posts |
Posted - 2008-09-10 : 05:49:24
|
| That is exactly what I was looking for.Thanks....The secret to creativity is knowing how to hide your sources. (Einstein) |
 |
|
|
|
|
|