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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedure Query

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 Status
By Project Name
By Designation
By Release Date
By Testing Expr
etc.....
like that we have 10 parameters......

Please suggest me a efficient solution to search based on single or multiple search condtions.

Thanks
Mousumi"

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 myTable
WHERE
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]
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-06-02 : 15:17:23
I still like....

http://weblogs.sqlteam.com/brettk/archive/2004/05/05/1312.aspx

How does google do it I wonder....



Brett

8-)
Go to Top of Page
   

- Advertisement -