I'm using a stored procedure to search in my database and filtering the results on a parameter and I need to filter on unknown multiple parameters.
How can I write a stored procedure that handles this??
Here is my stored procedure :
CREATE PROCEDURE ComplaintRefListOnDistrict
@District nvarchar(max) = ''
AS
BEGIN
SET NOCOUNT ON;
SELECT
ComplaintFullID, CustomerName, Customer_Address, CustomerEmail,
Date, ContractID, CustomerPhoneNumber,ID, Complaintreference_ID, State
FROM
dbo.ComplaintsSmartObject
LEFT JOIN
dbo.UsersDistricts ON dbo.UsersDistricts.District = dbo.ComplaintsSmartObject.District
WHERE
(dbo.UsersDistricts.District = @District)
END
GO
Thank you!
@Districtis input parameter. When you say multiple parameter i believe you mean multiple and unknown values in @District . If that's correct then please share the string which you wish to pass to this sproc.