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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-06-02 : 07:15:00
|
| Mousumi Sahoo writes "I have a stored Procedure which is used to search based on selected search conditions, like Searching Combinations of follwoings:By StatusBy Project NameBy DesignationBy Release DateBy Testing Expretc.....like that we have 10 parameters......Please suggest me a efficient solution to search based on single or multiple search condtions.ThanksMousumi" |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2004-06-02 : 15:00:15
|
| Well, how "efficient" this is will depend on many things like indexes, updated statistics, tables sizes, etc. But one approach would be to create a stored procedure where you pass in the search values as parameters (for example, named @Status, @Project, and @Designation). Then the SQL in the sproc could look something like this:SELECT ...FROM myTableWHERE Status = isnull(@Status,Status)OR ProjectName = isnull(@Project, ProjectName)...and so on with the parameter & Field list.--------------------------------------------------------------Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url] |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|