You want to create a report (Search)
which has different filters :
Based on the filters u have to generate the report.
User can select all filters or none of the filters and can click on Search button to generate the button
Ur Stored Procedure should have that many input parameters (similar to filters) for getting the recordset.
Input parameters should accept null values
CREATE PROCEDURE spDoSearch @FirstName varchar(25) = null, @LastName varchar(25) = null, @Title varchar(25) = null AS BEGIN SELECT ID, FirstName, LastName, Title FROM tblUsers WHERE (@FirstName IS NULL OR FirstName = @FirstName) AND (@LastNameName IS NULL OR LastName = @LastName) AND (@Title IS NULL OR Title = @Title) END
WHERE (FirstName = ISNULL(@FirstName, FirstName) OR COALESCE(@FirstName, FirstName, '') = '') AND (LastName = ISNULL(@LastName, LastName) OR COALESCE(@LastName, LastName, '') = '') AND (Title = ISNULL(@Title, Title) OR COALESCE(@Title, Title, '') = '')